This project has moved and is read-only. For the latest updates, please go here.

Collision help - Action without reaction

May 29, 2009 at 4:01 PM

Hi there, people!

I have a scenario with like 10 players, i do want them to collide with each other but i don't want to allow player 1 to move player 2 when they collide. It's something like this thread


Since all players have the same mass and drag coeficients, it's pointless to change it.

In a few words, what i want is to have the collision but with the force generated = 0. To Newton i would say that i want the action without the reaction.


Right now, when a player is not moving i set his body.isstatic = true, and when he press a key to move i change it back to false. Right now it's working fine, but when both players are walking they will apply forces to each other, and i don't know if that will help or screw the gameplay. Maybe it will create a nice effect, but i would like to know if theres any way to set the collision resultant force = 0.



May 29, 2009 at 6:19 PM

This needs a workaround since it's not the desired result from a normal collision. It might be possible if you subscribe to the OnCollision event and cancel it (return false) - then you make sure that the player can't move (save his position before physics update and restore it after physics update).