- Home /
Finding the Current Vector of Travel
I am trying to make a realistic flight model, and I need to know what direction the object is moving so I can accurately create drag. I am looking for something like the yellow marker on the nav ball in Kerbal Space Program. Any help would be much appreciated.
Not sure of the issue. With physics, you can use rigidbody.velocity. Without physics, you can subtract a previous position from the current position.
Hope I'm not too late, I'm tryna do the same thing as in make a nab ball. Its driving me mad
Answer by trudeaudm · Sep 27, 2014 at 06:37 PM
A quick Google search can find this information for you but I believe you just need this.
var velDir = transform.InverseTransformDirection(rigidbody.velocity);
You should then have velDir.x,y,z
@trudeaudm - your use of InverseTransformDirection() means that 'velDir' will be the local velocity. That is if the object is flying straight forward, no matter what direction, the velocity would be (0,0,speed). I don't think that is what he is asking for, but maybe. 'rigidbody.velocity' is the world velocity.
what I am trying to achieve is to know what direction my object is facing in comparison to the direction the object is actually traveling.
Your answer
Follow this Question
Related Questions
Get the Vector position of the player object when clicking another object C# 1 Answer
Rotating a Vector3 in Instantiation 1 Answer
Moving a Platform 1 Answer
Instantiate GameObject towards player 0 Answers
Vector3 Projection 2 Answers