Angle of direction and rotation? Am i correct?
RH
Member Posts: 1,079
I really hate posting for help as I prefer to figure stuff out on my own, but after a long time searching the forums and testing ideas I can't figure it out.
I was wondering how to make an actor rotate to the direction that it is travelling. I saw vectorToAngle mentioned a lot but I'm not too sure what that does. I also guess that I will probably have to use a timer.
Am I correct in thinking that this will calculate the direction of travel:
asin( self.Motion.Linear Velocity.X / self.Motion.Angular Velocity )
I'm assuming that asin is short for arcsin or inversesin
If this is correct can I do something like this:
Timer: every 0.1 seconds
Roate to angle:asin( self.Motion.Linear Velocity.X / self.Motion.Angular Velocity )
I tried that but it didn't go too well, just rotated a bit in a direction that clearly wasn't where it was travelling and didn't do much good at all.
Any help is appreciated, Thanks
I was wondering how to make an actor rotate to the direction that it is travelling. I saw vectorToAngle mentioned a lot but I'm not too sure what that does. I also guess that I will probably have to use a timer.
Am I correct in thinking that this will calculate the direction of travel:
asin( self.Motion.Linear Velocity.X / self.Motion.Angular Velocity )
I'm assuming that asin is short for arcsin or inversesin
If this is correct can I do something like this:
Timer: every 0.1 seconds
Roate to angle:asin( self.Motion.Linear Velocity.X / self.Motion.Angular Velocity )
I tried that but it didn't go too well, just rotated a bit in a direction that clearly wasn't where it was travelling and didn't do much good at all.
Any help is appreciated, Thanks
Comments
constrain self.rotation to game.angle. The player will always face in the direction the joystick is making it travel.
I don't know what i was thinking when i started trying to use my maths knowledge,
Here is what i did if anyone still (or in the future) wants to know:
constrain attribute: self.rotation to (vectorToAngle( self.Motion.Linear Velocity.X , self.Motion.Linear Velocity.Y ))-90
Although it does work perfectly (thatnks for sharing with me from the future)