# Having trouble combining clampMagnitude and some explosion force

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.

• “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.
– Jon
Dec 29, 2020 at 15:11