Push Circles out from each other using p2.js

I’m having trouble making my physics bodies get pushed out from each other using the p2.js physics library with PlayCanvas integration. Has anyone figured out a solution to this? Currently, I check which bodies collide and then store them in a dictionary with the body’s id and have a list of any bodies that is intersecting, and then every frame I calculate the push force, but some of my bodies aren’t being pushed and I’m worried that my approach is expensive computational-wise and unnecessary. I have disabled Collision Response so that the circles can still send collision events but move through each other.


Hi @machineman1357,

p2.js isn’t easy to debug because you can’t easily visualize the colliders. I had the same issue, with objects getting pushed out from each other when I was setting the initial position of an object inside another’s collider.

Try adding some simple box models to visualize your colliders in case it’s the same problem.