#Access a scene tile's node from position ?
14 messages · Page 1 of 1 (latest)
Found a way to do it, made a general script that I attach to every object tile that adds itself to a (position):(self) dictionary in the parent tilemap, idk if it's optimal but it works
Hello 😊
Do you create your own tilemap node or use godot one ?
@thick jetty get_cell_tile_data ( int layer, Vector2i coords, bool use_proxies=false )
However you get the coords of the tile, pass it into this function. You may have to use, tilemap.local_to_map(vector2) first to convert to local tilemap coords.
I use the Godot tilemap node, and okay thanks for the help I will try it when I get back to it :)
I don't think this returns a node or a way at all to reference a node (which is what Scene Tiles are). It returns a TileData object, which scene tiles seem to not even have
@reef crater I see, I wasn't sure if you was using scene tiles, the only way I could find to reference scene tiles was after you create the tile, I use a dictionary with the location as the key. Then I just checked the dictionary for the tile.
Yeah that's basically what I'm doing too. I'm not the op but I was searching for an unrelated scene tile issue. I'm used the child_entered_tree signal on the tilemap to get a reference to the node, and then add that to a dictionary in just that same way.
The issue btw was that you can't re-instantiate a scene tile on the same tile, after it's been already placed and deleted (tile set to empty tile, and scene freed). The issue is fixed on the latest version https://github.com/godotengine/godot/issues/82597
Godot version 4.2 dev 4 System information Godot v4.2.dev4.mono - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2070 Super (NVIDIA; 31.0.15.3713) - Intel(R) Core(TM) i7-1087...
I never have that issue, I use scene tiles here....
https://discord.com/channels/212250894228652034/1148755669009317949
Are you using the latest version?
Yes, not the beta. 4.1.2
That's the one i was using, and having this issue on.
Yeah, for now you can't access scene tiles from the tilemap, not sure if it will be something they look into doing. A simple workaround I found was the dictionary. As a side note, I'm in the process of scrapping my scene tiles and just open the functionality of the tilemap.