Rotating actor towards the direction it is moving

alexmayhewalexmayhew Member Posts: 5
edited November -1 in Working with GS (Mac)
I have been trying for about a day to get an actor to continually rotate toward the direction it is moving. Does anyone have any ideas how to do this? Any help would be most appreciated.
Please go easy with me , I am a newbe

(:

Comments

  • victorkin11victorkin11 Member Posts: 251
    vectorToAngle

    Usage: vectorToAngle(x,y)

    Find the angle relative to the origin, (0,0), given an X and Y coordinate. You can include an offset,(x',y'), to find an angle relative to the offset.

    e.g. vectorToAngle(x-x',y-y')

    http://gamesalad.com/wiki/interface_reference:expression_editor
  • DookiDooki Member Posts: 247
    Hey there,

    Use a constrain attribute.

    Constrain Attribute
    constrain attribute: self.Rotate To:(vectorToAngle( self.Motion.Linear Velocity.X , self.Motion.Linear Velocity.Y ))-90

    You may have to play with "-90" value. When someone told me this they told me to add "+90" at the end but my actor faced the wrong way. My actor moves to where I tap, and where ever I tap he faces that direction.

    Cheers!
  • alexmayhewalexmayhew Member Posts: 5
    Thanks Both, I still am getting no joy, do either of you have any examples I can see? I must be doing something wrong somewhere along the line.
Sign In or Register to comment.