atan2() Function

New releases and general discussions.

Post » Tue Jul 07, 2009 4:11 am

A function I didn't realize was missing until I found out how amazingly awesome it is is atan2(). Any chance it could be added for the next build?
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Tue Jul 07, 2009 6:24 am

I wrote atan2 as a formula in an event, only to later realize there is an angle compare expression that does the same job I wanted done.
AngleDiff(a, b)

Is that what you're trying to do? measure of the arc between two angles?
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Tue Jul 07, 2009 8:14 am

The angle() expression which measures the angle between two points uses atan2. I'm not aware of any other uses for atan2.

If you pass 0 as one of the two positions the result is exactly equal to atan2, ie. angle(0, 0, x,y) is equal to atan2(y, x).
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Tue Jul 07, 2009 3:12 pm

I didn't even think of doing that with the angle() expression. :P I'm using the function to get the angular speed of an object based on it's separate X and Y speeds.
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 3 guests