Can I reference underlying scene placed using SceneCollections on a Tilemap by its Vector2i coordinates?

Godot Version

4.2.1

Question

Hi there (thanks for popping in!),

I recently learned that we can use scenes as tiles in tilemaps!

This is really powerful to me as I can then code methods and properties to scenes that are instantiated in the tilemap.

But I can’t find resource as to how I can reference the added child scene in the TileMap via their cell coordinates relative to the Tilemap.

How can I access the instanced scene child , say… at Vector2i(1,2) of the TileMap, so as to trigger a method of that SceneTile. Is there a way I can do this?

Even if there’s no built-in method/function to achieve this, is there a elegant work around? E.g. Converting the Vector2i of the tilemap to its global position, then using it somehow to reference the scene tile placed at that location?

Thanks in advance!

I don’t understand what you want to do. I hope you can describe more details.

Hi, sorry for not being clear.

I made custom tile blocks for an isometric tilemap, each saved as a Scene. An example of such a scene here:

  • These scenes are custom and can have scripts/components attached to them.
  • An example of such a component, would be an animation that can play when the attached Area2D detects a mouse over event.

I then placed these on the tilemap using a SceneCollectionSource tileset.

Since cells on tilemaps have a corresponding reference Vector2i coordinate, e.g. (0,0), (0,1)…
I wanted to know if I can access the underlying Scene thats instantiated as a tile on the tilemap at a particular Vector2i.

An example situation would be when I have an event that would affect a range of tiles on the tilemap (e.g. Vector2i(0,0), Vector2i(0,1), Vector2i(0,2)). I want to reference the child scenes planted as tiles on these coordinates in the tilemap, to invoke methods in their scripts.