I have a character that uses rigidbody, and I am using AddForce() to make it move. And so I do rb.velocity = Vector3.ClampMagnitude(rb.velocity, maxSpeed) to limit diagonal speed. Yes that did worked but my problem is adding for example explosion force. So if explosion force is very high, it will still clamp the velocity of the player. What way should I use to combine movement that limits diagonal speed and a properly working explosion force toward the player. At least give a clue how can I do it?

My only main problem here is the way that I implemented to limit diagonal movement. I wanna improve that by not using Vector3.ClampMagnitude() so the AddExplosionForce() will work properly to the player. Because clamping magnitude of the player will also limit the velocity when it is affected by the explosion force.

So can anyone give a clue how can I implement to limit diagonal movement without using clamp magnitude?

I thought about normalizing the move like:

Vector3 move = transform.right * x + transform.forward * z;
move = move.normalized * Time.deltaTime * moveSpeed;

But I realized I am using AddForce(). Even though I limited the diagonal speed, it will go faster and faster because there is no maxSpeed. Help please.

  • \$\begingroup\$ “It will go faster and faster” explosions are more easily modeled using a blast radius. Make sure that you only apply force while within the blast radius, or for a limited amount of frames. Otherwise it will simply continue to accelerate. You should also make sure to have linear drag set on your rigid body. This is typically more desirable than basic velocity clamps. This allows you to reach a sort of natural terminal velocity rather than a sudden clamp. It also makes movement more realistic. \$\endgroup\$
    – Jon
    Dec 29, 2020 at 15:11

1 Answer 1


Simply add an isExploding bool which is set to true in your AddExplosiveForce() function and divide your update into two parts, one is if (isExploding) and the second being the else block.

If it’s exploding, check the rigidbody’s velocity magnitude to see if it is less than your max velocity. If so, set isExploding to false. Else if not exploding, clamp the velocity.

You may need to wait a frame for the velocity to show up after adding the force (acceleration must be integrated), if so, simply make sure the explosive force is applied after the check for velocity clamp.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .