GameSalad Interpolate Rotation Problem (Video)

dmilinovichiiidmilinovichiii Member Posts: 620
edited June 2012 in Working with GS (Mac)
I'm having a problem getting an actor in my game to rotate correctly. Here is a video explaining the problem:


Does anyone know how I can fix this?

Best Answer

Answers

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    This occurs when the angle changes from359 to 0 (or when it goes from 0 to 359). One formula to fix this is: ((theAngle+180)%360)-180
  • dmilinovichiiidmilinovichiii Member Posts: 620
    Thank you. I will try that.
  • dmilinovichiiidmilinovichiii Member Posts: 620
    This occurs when the angle changes from359 to 0 (or when it goes from 0 to 359). One formula to fix this is: ((theAngle+180)%360)-180
    Unfortunately, this didn't work. What happened is that the problem now occurs on the left side at the 180 degree mark.
  • dmilinovichiiidmilinovichiii Member Posts: 620
    Is there any other way I could do this?
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Hmm... not sure why its not working. Can you tell me how you have things set up? For example, are you using the official cross-platform controller template? And how are you obtaining the joystick angle and then using it to get the actor to rotate. The more info the better!
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    I don't think there is anyway to do it with interpolate. Try constraining the actor rotation to the vector2angle of the mouse position and the center of the rotation control.
  • dmilinovichiiidmilinovichiii Member Posts: 620
    I don't think there is anyway to do it with interpolate. Try constraining the actor rotation to the vector2angle of the mouse position and the center of the rotation control.
    I tried that but I don't like the constrain feel. The movement isn't smooth.
    Hmm... not sure why its not working. Can you tell me how you have things set up? For example, are you using the official cross-platform controller template? And how are you obtaining the joystick angle and then using it to get the actor to rotate. The more info the better!
    I made it myself. I have checked the behaviors and the output correctly gives the angle.
  • dmilinovichiiidmilinovichiii Member Posts: 620
    @RThurman
    Thank you very much! I finally got it to work! I can't thank you enough. Now I can finally get on with my project.

    Also, thank you to everyone else for trying to help me figure this out.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Glad its working for you!

    RThurman
Sign In or Register to comment.