how to disable collision between 2 kinematic body 2d ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: 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?

:bust_in_silhouette: Reply From: Thomas Karcher

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.

:bust_in_silhouette: Reply From: Guliver_Jham

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.