Best way for Helicopter Rotation?

forkliftforklift Member Posts: 386
edited November -1 in Working with GS (Mac)
If anyone's made a helicopter in their game before, I'd like to hear your input on the ways you made it rotate realistically in a side view. Note: the actual vehicle, not the blades - that's in an animation.

I have the helicopter's (not controlled by player) animation facing the direction of travel based on X velocity.
This works:
When self.movement.X is (equal to or greater than) 1, use right-facing animation
When self.movement.X is (equal to or greater than) -1, use left-facing animation
When self.movement.X = 0, use the last-facing animation (so it's still facing last direction of travel)

But when I add in rotate logic, it doesn't reset to the original (non-rotated) position.

When self.movement.X is (equal to or greater than) 1, use right-facing animation, and rotate to 335 degrees
When self.movement.X is (equal to or greater than) -1, use left-facing animation, and rotate to 25 degrees
When self.movement.X = 0, use the last-facing animation (so it's still facing last direction of travel), rotate to 0 degrees.

For some reason it keeps adding the rotation value, even when i have the Otherwise statement using a 0 degree rotation. so after a few passes of left and right, it's basically upside down or straight up and down.

Any pointers?

Comments

  • forkliftforklift Member Posts: 386
    I've been thinking on this one for awhile, busy doing other stuff in the game.

    Maybe I need a long set of rules so that the actor has time to rotate to angle and back to zero properly. Such as:

    When self.linearvelocityX >= -11 <= -15 & rotate to 15
    When self.linearvelocityX >= -6 <= -10 & rotate to 10
    When self.linearvelocityX >= -1 <= -5 & rotate to 5
    When self.linearvelocityX = 0, rotate to 0
    When self.linearvelocityX >= 1 <= 5 & rotate to 355
    When self.linearvelocityX >= 6 <= 10 & rotate to 350
    When self.linearvelocityX >= 11 <= 15 & rotate to 345

    you get the idea... i'll try this later and report back.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    In my border patrol game i just made my helicopter scroll back and forth with the blades rotating not how you want so i cant tell you off the top of my head and tell you what your doing wrong. But im gonna play around with this now and im thinking theres a easy way to do this.
Sign In or Register to comment.