0 votes

· collisionlayer
This describes the layers that the object appears in. By default, all bodies are on layer 1.
· collision
This describes what layers the body will scan for collisions. If an object isn’t in one of the mask layers, the body will ignore it. By default, all bodies scan layer 1.

As far as I understand, according to the documentation, if you test for collisions, for example using "moveandcollide", the system will report collisions with bodies that are in a collision layer that is in the collision mask of the object we are calling the function on.

However, that is not always true.

Collisions are also detected against an object that happens to be looking for a mask that the object that is checking for collisions is in.

For example, you can have an object that is in no layer, but is testing for the player mask. Then, the player (that of course is in the player mask), is going to collide against that object when executing moveandcollide.

Is this the intended behaviour?

If it is, that's not what I understand from the docs.

enter image description here

asked Jun 4 in Engine by Thenend (15 points)

1 Answer

0 votes
Best answer

Yes I believe you are correct. Adding a collision detection from one object to another, is like you've done it in both. Don't add it to the collision layer.
Here's a good video about collision: Using Physics Layers and Masks in Godot 3.1 (tutorial)

answered Jun 5 by deaton64 (1,261 points)
selected Jun 5 by Thenend


In that case, I think it should be corrected in the documentation. While searching around I found much confussion with this behaviour.

I'm really liking Godot as a tool, but bugs in very basic funtionality and misleading documentation are keeping me away from recommending it to other developers :-(

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.