Shortest rotation angle?

Get help using Construct 2

Post » Tue Apr 16, 2013 9:06 pm

Angle(x1,y1,x2,y2) will return either positive or negative 0-180 depending on the order of objects x, and y's used.
So basically it doesn't care about the shortest route, just the order.
I guess in theory you could use that as well to get the shortest angle by testing + or -.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Tue Apr 16, 2013 11:30 pm

[QUOTE=Magistross] [CODE]if (360 + Target.Angle - Player.Angle) % 360 > 180   .... CCW
else                                                 .... CW[/CODE]

Should work for any valid angles.[/QUOTE]

Thank you!

@Yann, you didn't offend me, I'm just extraordinarily harsh when I get replies that seem to 'probe' and be less related to answering the question.

I think this might actually be a good add to the list of topics on the FAQ, but maybe better worded there because "Shortest rotation angle" can be kind of misleading.
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,194

Previous

Return to How do I....?

Who is online

Users browsing this forum: Governador, Radulepy, tarek2, Thelegendvinny, TiagoCesar and 23 guests