How to stop the body after detecting collision .

Topics: Developer Forum
Mar 17, 2013 at 6: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 .

Thanks
Mar 18, 2013 at 1: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 1: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...

Mike.
Mar 18, 2013 at 8:04 AM
Hi,
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 ?

Thanks
Mar 18, 2013 at 3: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.

Mike.