User Tag List

Results 1 to 8 of 8

Thread: Rotate Active Based on Mouse Position

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export Module
    Retrobolt's Avatar
    Join Date
    Mar 2016
    Posts
    395
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Rotate Active Based on Mouse Position

    In Fusion, for some reason moving using angles is counter clockwise, but ATan2 is clockwise which make the mouse angle movement mirror itself.
    Does anyone know how to fix this?

    I want the rotating active ship to move and rotate around based of the mouse position.

    Rocket Game Proto.mfa

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export Module
    Retrobolt's Avatar
    Join Date
    Mar 2016
    Posts
    395
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Fixed

    Thanks to OKAsti from the Zentaco Productions Discord. https://discord.gg/WKbrG9q

  3. #3
    Clicker Fusion 2.5 DeveloperSWF Export Module
    N64Mario's Avatar
    Join Date
    Nov 2008
    Location
    USA
    Posts
    1,306
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    I know you said it's already fixed, but for anyone else who wants to know on what to do to fix:

    Change:
    - Always -> [Rotation] -> Set angle to ( ATan2(XMouse - X( "Enemy Ball" ), Y( "Enemy Ball" ) - YMouse) + 360 ) mod 360

    to this:
    - Always -> [Rotation] -> Set angle to ( ( ATan2(XMouse - X( "Enemy Ball" ), Y( "Enemy Ball" ) - YMouse) + 360 ) mod 360 ) * -1

    Basically, I added ()'s in all the math, and then a * -1 at the end of that.

  4. #4
    Clickteam Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleInstall Creator Pro
    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)
    BartekB's Avatar
    Join Date
    Aug 2013
    Posts
    622
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    You've mixed up x and y in the atan2 function.

    Simply try ATan2( Y - Y2, X2 - X )
    ...where X and Y is the position of the object, and X2/Y2 is where you want the object to look at.

    Saying this for reference when someone else comes across this thread (which is why I'd be neat if you said what fixed it).
    - BartekB, a.k.a Uppernate
    Join the Click Converse Discord! - https://discord.gg/7RNXFrC
    Dungeon Raiders! - Link soon™

  5. #5
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCiOS Export ModuleInstall Creator Pro
    Julian82's Avatar
    Join Date
    May 2012
    Location
    outbuddies.com
    Posts
    922
    Mentioned
    44 Post(s)
    Tagged
    0 Thread(s)
    Do you guys know if there's a heads up about the most practical geometrical math expressions that can be used in game design, especially for creating complex movement patterns? I know there are dudes out there who basically calculate everything (for example boss creature limbs) using sin and cos expressions and I would love to learn this too. Also, are there more functions like ATan2 out there, which are of highly practical (every day) use? Besides using ATan2 I only know how to calculate distances and got a simple sine wave movement to work, but that's about it.

  6. #6
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,166
    Mentioned
    78 Post(s)
    Tagged
    0 Thread(s)
    I highly recommend this: MATH: How I stopped worrying and learned to love the Expression Editor ($0.99 on the Clickstore). It sounds like exactly what you want, Julian.

    As it happens, I just went through it myself last night (despite buying it months ago). The earlier sections are pretty basic, but towards the end it gets into some really cool examples with trigonometry, easing, and bezier curves. The snake movement is incredible!

  7. #7
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCiOS Export ModuleInstall Creator Pro
    Julian82's Avatar
    Join Date
    May 2012
    Location
    outbuddies.com
    Posts
    922
    Mentioned
    44 Post(s)
    Tagged
    0 Thread(s)
    Thanks, man! I didn't know this existed, will buy it today! I also found a nice set of tutorials on game math on youtube, it starts pretty basic, which is good for a dude like me :P https://www.youtube.com/user/BSVino

    edit: I had a quick first look at the Clickstore tutorial, exactly what I was looking for, many thanks again!!

    edit2: This stuff is insane, didn't even know things like this are possible with Fusion!

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export Module
    Retrobolt's Avatar
    Join Date
    Mar 2016
    Posts
    395
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Here's a better version.

    ( ATan2(XMouse - X( "Enemy Ball" ), Y( "Enemy Ball" ) - YMouse) ) * -1

Similar Threads

  1. Replies: 2
    Last Post: 9th April 2016, 10:14 PM
  2. Replies: 2
    Last Post: 17th January 2016, 08:58 AM
  3. Another Rotate to Mouse question.
    By s0ba in forum Fusion 2.5
    Replies: 3
    Last Post: 26th March 2014, 05:12 PM
  4. Need help making a shot arrow rotate mid-air based on its speed!
    By edman3d in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 4th February 2013, 12:03 PM
  5. Aiming based on Mouse Position
    By playfair in forum The Games Factory 2 - Technical Support
    Replies: 2
    Last Post: 24th November 2012, 04:53 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
  •