User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: Getting Angle between pointA and pointB

  1. #1
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Getting Angle between pointA and pointB

    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

  2. #2
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleXNA Export Module
    ProdigyX's Avatar
    Join Date
    Jan 2011
    Posts
    1,197
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    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.

  3. #3
    Forum Moderator

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    nivram's Avatar
    Join Date
    Jul 2006
    Location
    Bandon, Oregon
    Posts
    6,773
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    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

  4. #4
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  5. #5
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, the Advanced Direction Object could also be used, but...
    I forgot to mention i want to do this without extencion use

  6. #6
    Clicker Fusion 2.5iOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    SolarB's Avatar
    Join Date
    Feb 2012
    Location
    Melbourne
    Posts
    904
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    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

  7. #7
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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 )

  8. #8
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleXNA Export Module
    ProdigyX's Avatar
    Join Date
    Jan 2011
    Posts
    1,197
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    (ATan2(X( "A" )-X( "B" ), X( "A" )-X( "B" ))) + 360...

  9. #9
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  10. #10
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleXNA Export Module
    ProdigyX's Avatar
    Join Date
    Jan 2011
    Posts
    1,197
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    MMF2 automatically takes the 360 modulus of any angle so the above actually will return 0/90/180/270.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Angle = Angle +0.3
    By Tuna in forum Multimedia Fusion 2 - Technical Support
    Replies: 12
    Last Post: 8th November 2013, 01:32 AM
  2. Angle towards...
    By Wolfking_Warrior in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 30th October 2012, 05:35 PM
  3. Angle bug
    By ColdFire in forum SWF/Flash Export Module Version 2.0
    Replies: 0
    Last Post: 12th August 2011, 01:26 AM
  4. angle
    By nick_Peoples in forum The Games Factory 2 - Technical Support
    Replies: 2
    Last Post: 16th March 2010, 12:45 AM
  5. Angle?
    By Iharmi in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 28th October 2008, 03:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •