- Home /
how to stop/suspend all motion after collision
I want to temporarily stop all motion of objects after an event (tap on the screen).
I can stop objects I am moving (in Update() ) by not updating their position.
But objects that have collided and have Unity given motion (physics) continue to move.
How can I temporarily suspend the motion given by the collider after collision?
Thanks for any help!
Answer by hathol · May 26, 2012 at 02:42 PM
You can set
YourObject.Rigidbody.velocity = Vector3.zero;
YourObject.Rigidbody.angularVelocity = Vector3.zero;
This will stop the object movement unless you are applying another force somewhere. If there are other forces that you can't controll, just zero the velocity at the end of every fixedupdate to be safe (and maybe disable gravity). You can of course save the current velocity before zeroing it and then reapply it if you want to restart it again later.
Your answer
Follow this Question
Related Questions
Object going through another....How to solve it? 0 Answers
Kinetic Energy 1 Answer
Object Collision PLEASE HELP!!! 1 Answer