how to make my sprite snap to tilemap?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By potatobanana

hi guys, i want to make my sprite snap to my tilemap map, but it wont snap when i use isometic, how should i do?
red box is my sprite, it snap like that
brown and green my tilemap

enter image description here

sprite node size x64 y32
tile size x64 y32
mode isometric

then i put this code:

func _unhandled_input(event: InputEvent) -> void:
	var tileNode       = get_node("TileMap")
	var mouse_cell_pos = tileNode.world_to_map( get_global_mouse_position() )
	get_node("TileTarget").global_position = tileNode.map_to_world(mouse_cell_pos) + tileNode.cell_size/2
:bust_in_silhouette: Reply From: DerPlagiator

Hi, late late answer, but for completeness:
I think you have to change the “tile origin”- property of the tilemap to center.

It is explained by KidscanCode in this Video: