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.

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 :slight_smile: