#Need to know if I understand masks/layers correctly.

5 messages · Page 1 of 1 (latest)

visual quail
#

Okay, so the way I understand it is:

Layers are used to alter an entity's visibility, including whether or not that entity is visible to other layers.

Masks are used when the entity is attempting to receive input or signals from stuff on other layers.

Do I have this right? Can someone please explain this to me in REALLY simple terms?

grim quest
#

I'm not an expert in layers yet but the way I understand it is the following:

  • layers are the layer the current object is in
  • masks are the layers which which the current object will interact with.

So if you've got an object on layer 1 but with no masks, it's not going to look for other objects to detect/collide with. But if another object is on layer 2 and have the mask 1 activated, it will detect objects on that layer, the first one 🙂

Hope this is clear enough 😉
Take care

topaz prawn
carmine forge
#

One good way to memorize it is to look at it from the frame of reference of a RayCast2D node. A RayCast2D has the following properties:

  1. RayCast2D can detect other things
  2. RayCast2D CANNOT be detected by other things
  3. RayCast2D only has a Collision Mask property. It does not have a Collision Layer property

So, what does this mean. This means that if I want to detect things, I have to use Masks like the RayCast2D. If I want things to detect me, I have to use Layers.

Another way to think about it is:
Layers - Where do I live/Where can I be detected
Mask - Where can I detect things

gritty raven
#

Masks (the kind you wear) usually have eyes. Eyes can see things, so the mask (in the engine) is what looks at the layer to see what’s there. That’s how I keep it straight in my head, anyway.