I am creating a rigidbody controller and i'm have a problem with restricting the velocity the rigidbody can gain from player input alone (ex: pressing WASD).
All of the rigidbody controller scripts I have seen until now do some kind of velocity verification to check if the current rigidbody velocity is lesser then the maximum allowed velocity, if it is addForce() is called, if not nothing happens. (ex:[http://wiki.unity3d.com/index.php?title=PhysicsFPSWalker][1])
The problem is that when the rigidbody gains a lot velocity because of something other then the player's input, the player stops being able to control the character (the maximum velocity is lesser then the current velocity so addForce() is not called)
I tried using a rigidbody off camera as a "force calculator" and use the method above described but that brings a new set of problems.
Is there a way I can calculate how much of the current velocity is a result of player input alone?
If not, what other method would you advice I use to restrict the maximum velocity the player can apply to the rigidbody?
[1]: http://wiki.unity3d.com/index.php?title=PhysicsFPSWalker
↧