0 votes

Hi there,
I want to put everything that can hurt the player on one separate collision layer.

I'm having trouble finding any kind of tutorial to detect the difference between objects on one specific collision layerto detect the player getting hurtthough. Any ideas where to look?

in Engine by (30 points)

1 Answer

+1 vote
Best answer

Look at the collision layer mask, a CollisionObject uses its mask to detect collisions with a layer, so, body with mask 1 will detect bodies in layer 1 and won't notice bodies in another layer.

Except for KinematicBody (3D) which does not uses masks for the movement API, only layers (is a bug/not updated implementation of "move") and areas may detect other areas if collision pair (layer-mask) match on any direction.


Sometimes you can put everything on the same layer and just filter by node group (depending on the complexity of interaction between the different elements).

by (7,840 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.