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
91
S
31
G
103
Posts: 5,241
Reputation: 67,768

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
168
S
50
G
164
Posts: 8,239
Reputation: 105,597


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests