Rotating actor towards the direction it is moving
alexmayhew
Member Posts: 5
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
(:
Please go easy with me , I am a newbe
(:
Comments
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
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!