4
\$\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\$

1 Answer 1

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\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .