Force Collision

I’m currently facing an issue, which I’m not quite sure how to resolve…

The player receives knockback of an enemy and gets pushed away. When next to a wall it can happen, that the player gets knocked out out of the room.

2024-05-2513-39-16-ezgif.com-video-to-gif-converter

I want the player and all the other objects to stay in the room. I’m using physics2 for the knockback explosion.

In addition I wanted to ask how I can prevent enemies to walk into the x and y of another so that they keep a distance. I know there’s collision, but it seems to push the enemies out of the room too…

Thanks for your help <3

Since you are using physics2, the walls should also be given physics2 behavior with the type as Static. If you have already done that then maybe you need to make them thicker… it seems like the player is being position-corrected out the other side of the wall?

Hmm… it seems like you may have some behavior conflicts. As a general reminder (for anyone who finds this thread), you should never combine any standard movement/collision behavior out of the main four (platformer, top down, basic forces, or physics).

They all have their own logic methods and are not designed to interact with each other, and in many cases will cause issues.

If you’re using top down and physics combined, you’ll need to stop using one or other other. If you’re using only physics for the knockback, you should stop using that and just use the top down behavior (by forcing a direction and adjusting their max speed/current speed), likewise, if you’re using physics for most things, you should not be using any top down/platformer/basic forces for collision.