0 votes

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?

asked Apr 13 in Engine by Macryc (289 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.