Godot Version
4.7.2
Question
How do I properly do click-detection on isometric tiles using TileMapLayer?
Seeing as the textures are cubes larger than the diamond-down isometric grid, I want the entire texture to be detectable as clicking on that coordinate grid space.
var local_mouse := main_layer.to_local(get_global_mouse_position())
var cell := main_layer.local_to_map(local_mouse)
if main_layer.get_cell_source_id(cell) != -1:
return cell
Simple code that returns the coordinate of the clicked cell, however when I tried to implement a Physics Layer interaction, giving the tiles a collision box, inspired by this article:
https://ryanpoole.co.uk/2023/11/isometric-tile-selection-in-godot/
I quickly realised that get_coords_for_body_rid doesn’t seem to work properly, or at least I got Parameter “found” is null. What then is the correct approach with TileMapLayer seeing as that’s the future going forward?