|
So, I'm making a game which the player controls a ball down a hill. I made it so it adds a bit of speed every few frames but what I want is when the player reaches a certain velocity their speed will be limited. How would I do this?
(comments are locked)
|
|
Something along these lines should do it You could check for IsAsleep() as well, also if .rigidbody is null, but that's just being nitpicky :P
Jul 30 '10 at 07:49 PM
qJake
Indeed to the rigidbody is null check, but I wouldn't check for IsAsleep() - it'll hit zero velocity first, and asplode the calculations o.O
Jul 30 '10 at 08:03 PM
Mike 3
(comments are locked)
|
|
For rigidbpdy, I use FixedUpdate http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.FixedUpdate.html
In this case, more velocity will be added only if the velocity is less than the limit (velocityMax)
(comments are locked)
|
|
maybe you could increase the drag property on inclined downward slopes.. it is not the best solution but it worked for me.
(comments are locked)
|
|
See this question: http://answers.unity3d.com/questions/2502/limiting-rigidbody-velocity
(comments are locked)
|
