Problems with Raycasts not detecting objects

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

This is a seemingly random occurrence that tends to pop of every few times I load a level. I’m using a raycast to detect whether the player in standing on an Ice tilemap, which I have overlayed on top of a normal ground tilesmap. The Ice tilemap is above the normal Tilemap in the node list, so it should, and typically does, take priority during collision and proclaim that the player is on Ice .However, every now and then it doesn’t.

Sometimes it doesn’t work for every Ice tile in the level. Other times it will work for most of them, but a few tiles here and there won’t work. I’m not sure why this is happening. Printing the raycast collider shows it isn’t recognizing the ice.

One thing I’ve noticed is that I haven’t been able to get the glitch if I minimize the Godot Editor before loading the level in the game. The editor causes FPS lag during play, so typically I minimize it when testing things, however there are times when I’m not testing any that needs it minimized so I’l just leave it open. Could the lag be interfering with the node’s load order or something? Is there a better way to prioritize raycast collision with overlayed bodies?