- Home /
Cap rigid body move speed, without capping rotation speed
I have a rigidbody and I want to limit its moving speed without affecting the rotation speed.
I tried to use:
Vector3 velocity = MainRigidbody.velocity;
if (velocity.magnitude > MaximumVelocity)
{
MainRigidbody.velocity(velocity.normalized * MaximumVelocity);
}
This does cap the moving speed but also caps the rotating speed. Is there a way to only alter the moving speed? It seems that velocity is the moving speed + the angularVelocity.
Answer by $$anonymous$$ · Feb 14, 2013 at 03:03 PM
I found my answer.
I have a few rigidbodies as children. And at cap time I capped all the rigidbodies velocity. But I changed it to only limit the main body (like in the code above) and that way the moving speed is limited but the rotation is free.
By making this simpler version for asking the question I actually solved it :)
Your answer
Follow this Question
Related Questions
How to Limit Speed of a Rigidbody? 2 Answers
How to limit the force from player input without limiting speed 2 Answers
Limit Speed One Axis 2 Answers
AddForce for spaceship acceleration, but with max speed 2 Answers
capping the speed of a rigidbody 2 Answers