- Home /
How do I keep objects with Rigidbody from moving slightly after they stopped?
I have prefabs that have Rigidbody2D, with Gravity: 0, Drag = 0, and Mass: 1.
I all shoot them in the same direction with constant velocity towards a collider, and they're supposed to pile up, without bouncing off.
the 1st prefab hits the collider, doesn't bounce off, stops completely and is unmovable (exactly the way I want)
the 2nd prefab hits the 1st prefab, stops, but bounces off very slightly and slowly.
the 3rd prefab hits 2nd prefab, bounces off more
the 4th prefab bounces off even more.
I tried to change the physics setting of the project but that didn't change anything. How do I get all prefabs to stop completely and be absolutely unmovable?
Thanks in advance
Answer by robertbu · Feb 20, 2014 at 05:02 PM
Not sure this is what you want, but you can do:
function OnCollisionEnter2D() {
rigidbody2d.isKinematic = true;
}