![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | glitso |
Using raycasts to detect tiles with static bodies attached, I am trying to get a reference to the tilemap I am using through the collision of the raycast. Whenever it detects a tile, however I get the error, “Invalid type in function ‘get_node’ in base ‘StaticBody2D (BasePlayer.gd)’. Cannot convert argument 1 from Object to NodePath.”
The error points to the line of code “var collider = get_node(x.get_collider())” where x is a reference to the raycast.
I have almost identical code that works when used to detect objects outside of a tilemap, so it seems to be the tilemap that’s the problem. Is there another easy way to get a reference to the tilemap through raycasting?