This project has moved. For the latest updates, please go here.

How to stop the body after detecting collision .

Topics: Developer Forum
Mar 17, 2013 at 5:42 AM
Hi ,
I am just doing a simple collision between two physics sprite but how can i stop one body on its collision with another static body , kind of wall in a pathway . I hope you understand the concept .

Mar 18, 2013 at 12:12 AM
a static body doesnt move unless you are changing its position somewhere in update, so your dynamic body should stop from going pass the static object on collision.

maybe you should reword your question.
Mar 18, 2013 at 12:57 AM
The Restitution property of Body determines how much a body bounces off another. Trying setting Restitution to 0. That should stop it bouncing... won't stop gravity though...

Mar 18, 2013 at 7:04 AM
I have set the restitution to 0 for both the bodies But what this does is when one body collides with another , the body slides along the boundaries of static body . I want to stop the moving body or like anything disappear the moving body . Any clue for that ?

Mar 18, 2013 at 2:59 PM
If you want the moving body to disappear, remove the body from the world and stop drawing it (world.RemoveBody). If you want the body to completely stop, I would suggest replacing the dynamic body (the one moving) with a static body at the point of contact.