Stopping immediately when collision happens

I tried to stop an actor(it has rigidbody and collider) immediately after collision.

so I coded.

void OnCollisionEnter(Collision info)
{
rigidbody.velocity = Vector3.zero;
rigidbody.angularVelocity = Vector3.zero;
rigidbody.inertiaTensor = Vector3.zero;
rigidbody.inertiaTensorRotation = Quaternion.identity;

collisionPos = rigidbody.position; //for checking position
}

But, after collision, collisionPos is often slightly different to rigidbody.position(=transform.position) of inspector window.

What’s wrong? Can’t I stop the exact position?

Hi!
you need to turn off the rigididbody´s connection to physx by setting isKinematic to true. Otherwise it will still be influenced by the physics simulation.

Hi! sven.

What I want is

if collision between character and character happens, both character stop immediately and do not give/take physical force to each other.

But if character use kinematic rigidbody, they can’t affect each other at all.

I mean, not physical force but making them stop.

Collision between kinematic/kinematic do not generate OnCollisionEnter().

Also, I want that characters can affect physical force to stage props.

Then, it seems that non-kinematic rigidbody is proper.

What should I do in this case?