User Tag List

Results 1 to 6 of 6

Thread: Test if two objects are facing opposite directions

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleXNA Export ModuleInstall Creator Pro
    Shadeve's Avatar
    Join Date
    Aug 2011
    Location
    GA USA
    Posts
    228
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Test if two objects are facing opposite directions

    So I want to make it so that when the (8 direction) player moves up, but the model object which looks at the mouse is facing any of the 16 angles down the player's speed is slower because he is running backwards.
    I'm trying to find a way to test when the model is facing a direction opposite of the player which have events for every single direction.

    Any suggestions?

  2. #2
    Clicker Fusion 2.5Android Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)
    Vetmora's Avatar
    Join Date
    Jul 2010
    Location
    Australia
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you have it so that when the player is moving up, it checks if the mouse y position is greater than the players y position? Then if this is true slow the players speed.

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    you need the difference among the two angles they are facing
    you can use this expression:

    abs(atan2(sin(modelangle-playerangle),cos(modelangle-playerangle))) > 90
    >>> player is facing the opposite direction of model

    since you are probably not working with angles,
    you can retrieve them roughly from directions:

    playerangle= player dir * 11.25
    modelangle= model dir *11.25

  4. #4
    Clicker Fusion 2.5Fusion 2.5+ DLC
    casleziro's Avatar
    Join Date
    Mar 2013
    Location
    United States
    Posts
    644
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    If you're using the 8 direction movement, the opposite of your current direction will always be Dir("Object")+16.

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleXNA Export ModuleInstall Creator Pro
    Shadeve's Avatar
    Join Date
    Aug 2011
    Location
    GA USA
    Posts
    228
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Alright so I tried your method @schrodinger, but I am getting the error too many closed brackets. Group.Player is the model, and Player is the Player.

    Abs(ATan2(Sin(currentAngle( "Group.Player" ) - currentAngle( "Player" ))))

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleXNA Export ModuleInstall Creator Pro
    Shadeve's Avatar
    Join Date
    Aug 2011
    Location
    GA USA
    Posts
    228
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Ah, okay, thanks casleziro. I'm using 8 directions so that worked. Thanks all!

Similar Threads

  1. Replies: 3
    Last Post: 7th November 2016, 11:58 PM
  2. Create or Duplicate objects in directions?
    By Emerson3 in forum Fusion 2.5
    Replies: 3
    Last Post: 3rd August 2015, 08:42 PM
  3. Making two objects move Opposite
    By Mazerwulf in forum Fusion 2.5
    Replies: 3
    Last Post: 5th January 2015, 06:00 AM
  4. objects and 8-directions move
    By qenio in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 8th January 2011, 02:45 PM
  5. How to place objects precisely opposite each other
    By vesperillo in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 28th August 2010, 07:13 PM

Posting Permissions

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