- Home /
How would I make it so that my character moves only so fast
I have tried add constant force but the problem with that is that the game objects moves faster and faster. I want to my character at the same speed all the time (unless it runs into a wall). Could someone please help me.
Answer by aldonaletto · Aug 21, 2012 at 12:39 AM
That's a common mistake: applying a force to a rigidbody creates an acceleration, which is a velocity variation - thus a constant force will make the rigidbody velocity increase at a constant rate (sky is the limit).
You can limit the velocity with Vector3.ClampMagnitude without modifying its direction (character script):
var maxVel: float = 12;
function FixedUpdate(){ rigidbody.velocity = Vector3.ClampMagnitude(rigidbody.velocity, maxVel); }
Your answer
Follow this Question
Related Questions
Making Character Stand? 1 Answer
A node in a childnode? 1 Answer
move character controller forward using gui button. 1 Answer
is it possible to rig and animate withing unity? 1 Answer
Instantiating rigged armor 0 Answers