How to resolve collision without either physics bodys being pushed?

I’m making a game with Arcade physics where I want it so two moving objects are not able to push each other on collision.

The default Phaser behavior seems to be that the body with the most force / velocity will push the other. But I want it so if two objects are moving towards each other in opposite directions, then they will stop on collision.

I’ve tried setting both bodies to be not pushable (through body.pushable = false), one body to be not pushable and the other to be immovable, both immovable, etc. and none of the combinations seem to work how I want it.

Is what I want possible with default behaviours? It seems odd that it wouldn’t be since I can see many use cases for this.

:wave:

I believe bounce 0 for both bodies should do that.

I solved the issue by the time the post was approved.

Setting both object’s body.pushable = false was correct but I also had to ensure that the two bodies’ velocities were set to 0 when a collision was detected.

This is probably because I move player/enemies by constantly setting and resetting velocities.

Thanks.