Collision masks and layer

Godot Version

4.2

Question

If set raycast parameter query.collision_mask = 4, raycast should only hit/detect staticbody on layer 4, right?

234123412341234

No, collision masks and layers use a bitset to store the data. The editor shows numbers ordered by their binary offset. To query layer 4 it must equal 0b1000 or 16

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.