|Topic was automatically imported from the old Question2Answer platform.
|Published before Godot 3 was released.
Hi, I’m tackling my first Godot project, I searched every Q&A and documentation I found about the topic but I’m still not able to successfully make a raycast.
I’ve got a scene with a TileMap object and another one with a Sprite and four RayCast2D child nodes. The raycast are enabled, and I’ve set TileMap collision layer to 2 (checking the second little box in the gui) and RayCast2D’s layer_mask to 2 (checking second box). The Sprite collision layer is 1, and collision mask 2 (I’ve got other objects that must collide with the Sprite but not the raycast, that have collision layer 1).
_fixed_process() of my Sprite I check
active_rc holding a reference to a RayCast2D. This never becomes true, i.e.
print(active_rc.is_colliding()) keeps printing False. I read that if collision mask matches layer mask the objects collide, but for raycast only layer matters.
How do I make the method
is_colliding() return True when the raycast collides with the tilemap (and nothing else), or what’s the proper way of obtaining the desired behaviour? I’d like to use GUI nodes and not cast the ray from code.