From bd86f4fc950cdc5bb4cb346f48c14a6e356dc4fb Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado Date: Thu, 7 Mar 2024 21:55:16 -0600 Subject: stop tracking live/ --- live/blog/g/godot_layers_and_masks_notes.html | 170 -------------------------- 1 file changed, 170 deletions(-) delete mode 100644 live/blog/g/godot_layers_and_masks_notes.html (limited to 'live/blog/g/godot_layers_and_masks_notes.html') diff --git a/live/blog/g/godot_layers_and_masks_notes.html b/live/blog/g/godot_layers_and_masks_notes.html deleted file mode 100644 index 1d55d97..0000000 --- a/live/blog/g/godot_layers_and_masks_notes.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - -Godot layers and masks notes -- Luévano's Blog - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- -
-
- -
-

Godot layers and masks notes

- -

The first time I learned about Godot’s collision layers and masks (will refer to them just as layers) I thought I understood them only to find out that they’re a bit confusing when trying to figure out interactions between objects that are supposed to detect each other. On my last entry where I ported the FlappyBird clone to Godot 4.1 I stumbled upon an issue with the bird not colliding properly with the pipes and the ceiling detector not… well, detecting.

-

At the end of the day the issue wasn’t that the layers weren’t properly setup but rather that the API to change the state of the collision layers changed between Godot 3 and Godot 4: when calling set_collision_layer_value (or .._mask) instead of specifying the bit which starts at 0, the layer_number is required that happens to start at 1. This was a headache for like an hour and made me realise that I didn’t understand layers that well or else I would’ve picked the error almost instantly.

-

While researching I found two really good short explainations that helped me grasp the concepts better in the same post, the first a bit technical (by Bojidar Marinov):

- -

And the second, shorter and less technical but still powerful (in the same post linking back to Godot 3.0: Using KinematicBody2D):

- -

While the complete answer is the first, as that is how layers work, the second can be used like a rule: 1) the layer is where the object lives, while 2) the mask is what the object will detect.

- - - - -
- -
- - - - \ No newline at end of file -- cgit v1.2.3-70-g09d2