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: 52
Reputation: 1,106

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
100
S
38
G
134
Posts: 5,556
Reputation: 85,325

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
178
S
50
G
206
Posts: 8,686
Reputation: 127,715


Return to How do I....?

Who is online

Users browsing this forum: PitfallJerry and 1 guest