Rigidbody Collision results in object flying away at high velocity

I am trying to make a really simple effect in a flying game, where colliding into a solid object causes the player to “bounce” off of it. I am testing this at low velocity.

I’ve applied rigidbodies and box colliders to my walls, and since they are solid walls, I’ve checked all the boxes for freezing position and rotation XYZ. see attached screenshot for all settings.

The character has a simple rigidbody as well; both have the same a basic physics material applied.

When the character hits the wall, at say 2mph, he flies away spinning at something like 20mph.

How can I get it so the character bounces off the wall with the same or less energy that he collides with?


45044-physics-material.png

Setting the velocity of the RigidBody is what is causing the unrealistic physics effects.

Control the RigidBody by applying forces instead to get realistic results.

In most cases you should not modify
the velocity directly, as this can
result in unrealistic behaviour. Don’t
set the velocity of an object every
physics step, this will lead to
unrealistic physics simulation.

from http://docs.unity3d.com/ScriptReference/Rigidbody-velocity.html

What is probably happening is that the player is bouncing back on collision then their velocity is being set instantaneously back to their original velocity before impact, resulting in a massive change in acceleration and therefore a massive application of force, which creates the huge bouncing effect, which is multiplied as they hit the obstacle numerous times before the bounce force overwhelms the velocity changes, or the player stops pressing the forward button.

If you set the velocity, it doesn’t allow for changes in direction due to collisions because the velocity overrides the velocity changes set by the collision.

Also, if the obstacles in the scene don’t move they don’t need rigid bodies applied to them (only colliders). If you do need to move them but they don’t move on impact, set them to IsKinematic = true, rather than constraining all their axes.

Extra-also, make everything to scale if possible, i.e. 1 unit in unity = 1 meter. Make the mass of the flying robot what you would expect that amount of metal to be in real life.
This gives the most realistic results, if that is what you are going for.

Rigidbody.drag must to help you.

First try to regular mass and grad into your rigidbody component.
Then try to change Physic Material in your colliders.

At last you can use script with OnCollisionEnter in colliders game objects

and change Rigidbody.velocity then collision with wall.