Godot Version
4.2.1
How to detect when a ChatacterBody3d collides with another CharacterBody3d?
I’m trying to make it so that when enemies (which are CharacterBody3d) collide with the player (another CharacterBody3d) then it starts a “hit” function and removes health from the player.
My player is in the “player collision layer” (layer 3) and the enemies are in their “enemy collision layer” (layer 4).
I want to start the “hit” function only when objects in the “enemy collision layer” collide with the player, how do I make it?
I could make this work with areas3d, but then I would need to duplicate the collision shapes of the enemies or the player, and this seems like a huge waste of resources when there are collisionshapes already working. There must be a better way right? How I do make this?
In the docs I found get_slide_collision(), but I don’t know how to use it, nor how to make it filter certain layers (only detect enemy layer).
I also need to detect which enemy collided with the player, so that each enemy deals different amounts of damage, is there a way to do this as well?