How do I find the angle between 3 points?

Get help using Construct 2

Post » Thu Jun 23, 2016 1:47 pm

There is a sprite moving on mouse click.
Is there any way to find the angle between two coordinates (vector) of the sprite and the mouse click coordinates?
Image
B
20
S
4
Posts: 51
Reputation: 1,104

Post » Thu Jun 23, 2016 3:21 pm

You could use the angle() expression on both vectors to get their angles, then use the anglediff() expression to find the angle between them. Another way would be to utilize a vector dot product to find the angle.
B
92
S
32
G
109
Posts: 5,294
Reputation: 70,999

Post » Thu Jun 23, 2016 3:37 pm

Anglediff(angle(touch.x,touch.y,sprite.x,sprite.y),sprite.angle)
maybe?
Or would it be sprite.angle-180 to get the vector coming from the third point?
Image ImageImage
B
169
S
50
G
174
Posts: 8,328
Reputation: 110,800


Return to How do I....?

Who is online

Users browsing this forum: Kin, mickclarke, tinhofiel, TRMG, Yahoo [Bot] and 45 guests