How can i get the Angle between pointA and pointB, without the use of extencions?
I tried using
ATan2(X( "A" )-X( "B" ), X( "A" )-X( "B" ))
But it only seems to work between angles 0 to 180
How can i get the Angle between pointA and pointB, without the use of extencions?
I tried using
ATan2(X( "A" )-X( "B" ), X( "A" )-X( "B" ))
But it only seems to work between angles 0 to 180
1. You need to use X and Y positions. Not just X #_#
2. For me it worked with Atan2(X1-x2,Y2-y1) but keep changing the order and you'll get it eventually.









Angle and Distance Example - Nostalgia
Author: unknown
Genre: example
Extensions Needed: none
Description:
The Angle and Distance Example uses the Pythagoras' Theorem and other formulas. From an old cca file with an uknown date.
Instructions:
On screen.
Link:
http://castles-of-britain.com/mmfexamples-a.htm
Marv
458 TGF to CTF 2.5+ Examples and games
http://www.castles-of-britain.com/mmf2examples.htm
Thanks
The formula i originally posted was incorrect, this is the correct formula: ATan2( Ya - Yb, Xb - Xa ).
I see that MMF2 alters and interperates the output of the formula correctly, when it applies it to an Angle that is.
( Seems like MMF2 handles Angle values outside the range 0 - 360 correctly, by wraping the value somehow )
However the value output of the formula itself is incorrect ATan2( Ya - Yb, Xb - Xa ).
https://dl.dropboxusercontent.com/u/...weenPoints.mfa
I am using Sin Cos to move my object at an angle, and as such this methods output does not provide or produce correct results.
More specifically, when moving my Object using Sin Cos using this method, my Objects movement is confined to angles 0 - 180.
Yeah, the Advanced Direction Object could also be used, but...
I forgot to mention i want to do this without extencion use
Forgive me if I misunderstand you King_Cool, but there's nothing wrong with your example except you need to offset the angle by +90deg.
You would also need to use decimal movement to get a more accurate heading, if movement is what you are after.
AngleBetweenPoints2.mfa
Basically i just want a function which returns the Angle ( 0 - 360 ) between ObjA and ObjB
ATan2(X( "A" )-X( "B" ), X( "A" )-X( "B" ))
Produces
ATan2(X( "A" )-X( "B" ), X( "A" )-X( "B" )) + 180
Produces
But thats as close as ive gotten ( withput them extencions that is )
(ATan2(X( "A" )-X( "B" ), X( "A" )-X( "B" ))) + 360...
I seem to have posted ATan2(X( "A" )-X( "B" ), X( "A" )-X( "B" )) above which is incorrect...
ATan2(Y( "A" )-Y( "B" ), X( "B" )-X( "A" )) + 360
![]()
MMF2 automatically takes the 360 modulus of any angle so the above actually will return 0/90/180/270.