Rock back and forth

ckck Member Posts: 224
edited November -1 in Working with GS (Mac)
Does anyone know how to make an actor gently rock (rotate) back and forth, and also limit their rotation on collision with another actor?

Comments

  • aalzankiaalzanki Member Posts: 283
    You can find a tutorial for back and forth in the wiki.

    regards,
  • rebumprebump Member Posts: 1,058
    My wave demo does a back-n-forth wave motion about a center point:

    http://gamesalad.com/game/play/40104

    But you just might be wanting just a rotation back-n-forth. I do one with two "rotate to angle" behaviors. If they traverse 0/360 degrees, you may have to play around a bit. You could try just "rotate" behaviors with rules to detect the rotation and stop upon passing it (don't use equal).

    For no rotation on collision, you can check the checkbox for "Physics->Fixed Rotation".
  • ckck Member Posts: 224
    Thanks rebump. I downloaded your project and played with it. Very nice.

    In the end, I've gone for the solution of this:

    Set the angular velocity to 5
    In a timer, every 2 seconds, change the angular velocity to the negative of the angular velocity.

    That seems to have done the trick.
  • rebumprebump Member Posts: 1,058
    Good idea on using a timer to enact the change. Hard to get an exact movement but if it doesn't need to be exact then you are golden!
Sign In or Register to comment.