playMaker

Author Topic: Best way to handle a smooth rotation in this situation  (Read 1929 times)

magritte

  • Playmaker Newbie
  • *
  • Posts: 12
Best way to handle a smooth rotation in this situation
« on: May 24, 2015, 05:42:12 PM »
I'm working on a 2.5d game that plays similar to Choplifter.

Choplifter screenshot: http://gamesdbase.com/Media/SYSTEM/Arcade/Snap/big/Choplifter_-_1985_-_Sega.jpg

What I'm trying to do is build an FSM to have the helicopter rotate so the nose points slightly downward when the helicopter is moving forward, at an angle which is proportional to the helicopter's velocity. I've tried two methods, both of which introduce some undesired behaviors:

1) RotateTo. This works, but the movement is instantaneous where I need it to be smooth.

2) iTween RotateUpdate. This accomplishes the rotation in a smooth way, but the problem is RotateUpdate calls for a vector3 rotation -- you can't constrain the rotation to a single axis. I only want this FSM to control rotation on the z-axis, but using rotateUpdate here interferes with another FSM that I have handling the x-axis rotation.

Is there a better solution? I've considered writing a script to lerp the rotation with time, but I'm wondering if I'm missing an easier way. Thanks for any assistance.

magritte

  • Playmaker Newbie
  • *
  • Posts: 12
Re: Best way to handle a smooth rotation in this situation
« Reply #1 on: May 25, 2015, 09:07:36 PM »
It also occurred to me that I could itweenUpdate a single float variable, but I can't find a function to do that in PM or the ecosystem -- is it possible?