3d gridmap: Need help with world_to_map

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

Hi All. I’m using world_to_mapto translate the world coordinates onto grid coordinates. World coordinates are captured by a raycast function which intersects with the gridmap and returns the position of the collision point.

Problem: Where there are no tiles, intersect_ray still returns a collision point because it collides with the entire gridmap object regardless of whether there are any tiles.
world_to_map on the other hand, does need tiles to exist so it can translate the coordinates. Effectively, when I click on an empty tile, I get an error from world_to_map saying sorry mate, there is nothing there, I don’t know what ‘position’ you’re trying to pass in. intersect_ray though does pass in the position because, tile or not, it collides with the gridmap and returns the position which is then passed into world_to_map.

Question: How do I (a) stop intersect_ray from detecting empty grid tiles, or, (b) How do I make world_to_map think there always is a tile everywhere (even if there isn’t) without having to actually paint all tiles in?