- Home /
How do I create and track momentum for CharacterController? (How to apply decaying Velocity to a Character Controller)
Hi! Quick question:
How do I apply decaying Velocity to a CharacterController in mid-air?
I have a First Person Controller that I'm attempting to add inertia/momentum to. Right now, if I move the FPC using SimpleMove through the air, it moves as expected. However when I release, it drops like a stone.
My expected behavior is that it would continue to move in a decreasing arc, in the direction of it's most recent move until it hits the ground (or is acted upon by another SimpleMove).
Based on other answers: I suspect the answer is to use the initial position of the SimpleMove, and subtract that from the final position of the SimpleMove, and divide that by Time.DeltaTime, in order to get the real velocity (as opposed to using CharacterMotor.velocity, which is apparently not good for this application.)..
Then, the idea is to apply that velocity to the FPC overtime with a decay.
This is where I fall apart a little bit. I'm not sure how (or where, programmatically speaking) to apply the Velocity to the First Person Controller, nor how to decay it.
Thanks for any and all advice.
Here is one question dealing with adding a velocity to a character controller:
http://answers.unity3d.com/questions/487817/how-do-i-include-the-transform-direction-when-chan.html