Godot Raycast2D in Node issue

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By putskan

I’m creating a 2D platform game. I’ve been recently trying to check for collisions on raycast2D, and from some reason, it didn’t collide with anything at all.

After a while, I’ve found that the reason is that they are children of a “Node” node.
After changing to Node2D it worked perfectly.

I was wondering if someone may be able to explain that phenomena.

Much appreciated.

:bust_in_silhouette: Reply From: Fernando Brandt

The “Node” node doesn’t have 2D properties like position, rotation… so it doesn’t work well with 2D nodes.

Makes sense I guess.
Out of curiousity, would you mind elaborating a bit more about “doesn’t work well”?

Why would raycast2D “care” about its parent when checking for collisions?
In terms of how the engine works.

Thanks for the answer!

putskan | 2021-01-03 20:22