- Edited
The game I'm making is a 2d platformer which you should be able to destroy tiles as you get close to them (something like terraria), to do it I implemented a raycast2d to detect which tile (using tilemaplayer, not tilemap, this may be important) the player is colliding with. This is my code (but it passed through several changes and versions)
if Input.is_action_just_pressed("mine"):
if rc.is_colliding():
var l = rc.get_collision_point()
var cell:Vector2i = tmpi.local_to_map(l)
var data = tmpi.get_cell_tile_data(cell)
print(data)
else:
print("nada")
what is printed in data is "object null" but var cell it shows correctly the tile position. In other of my tests I used get_atlas_cords, also returned to -1,-1 meaning its null
just showing the big picture because maybe I'm doing the whole thing wrong... and because I'm stuck in this for 3 days
pls help