Topic was automatically imported from the old Question2Answer platform.
Asked By
Thakee Nathees
in my game the player and the npc are kinematic body 2d, walls are static body 2d and i don’t want my player and npc collides with each other, but they have to collide with the wall, how to implement this?
This can easily be done with collision layers and masks:
Just create different layers for all your object types (walls, player, npcs) and make sure to only include walls in the collision masks of players and npcs.
Sorry for all the people that didn’t get what they asked for. (pretty annoying if you ask me, seriously tought, that answer didn’t state the simpler method)
You do this with AddCollisionExceptionWith(body), it’s a very simple method that is always handy.