How to place the position of an object on the coordinate position of the tilemap cell

Godot Version

Version4.2

Question


When I was creating the construction system, I set all buildings to be placed on the cell coordinates of the tilemap, but there was an offset between the node positions added in the original scene and the tilemap.
May I ask, what other ways are there besides adding these node scenes to tilemap?
Thank you very much.

You’ll need to offset the origin of the nodes in your scenes to the place you want them or offset the final position when calculating the position of the instanced scene.

Adding the scene to a tileset scene collection won’t fix the issue. You will need to offset the origin of the nodes in your scenes in that case.