3
\$\begingroup\$

To begin, I know that you can use filtering or isSensor to remove physical collisions. However, I would like to retain the ability to, say for example, stop when trying to move past another player. Essentially, I don't want one player to be able to push another dynamic body with the force that normally accompanies a collision. I've tried static and kinematic bodies, but both obviously have their own problems with trying to have collisions.

An example might be a topdown game such as League of Legends of Starcraft, where units can impede on eachother's movements, but don't apply any force upon collision.

\$\endgroup\$
3
\$\begingroup\$

I figured it out. Each dynamic body (what you control) must have an accompanying kinetic body "shadow". Their collisions must be set up as follows: each dynamic body only collides with other dynamic bodies' kinematic body shadows but not their own shadow, so dynamic bodies no longer collide with each other. This way, since dynamic bodies can't push kinematic bodies, they won't push each other around. The kinematic bodies can be added to a dynamic body simply by using setTransform to match shadow positions with their parent bodies.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.