Godot Version
4.3.Stable
Question
Hello,
I am confused to why two functions are giving me two different results.
The functions are meant to give the coordinates of a mouseclick on a grid layer.
Only the second function gives the correct coordinate.
Could someone help me understand what exactly is wrong with the local position in the first function?
func _input(event):
if event.is_action_pressed("select"):
var local_coordinate = to_local(event.position)
var map_coordinate = local_to_map(local_coordinate)
print("coordinate: ", map_coordinate)
func _input(event):
if event.is_action_pressed("select"):
var local_coordinate = get_local_mouse_position()
var map_coordinate = local_to_map(local_coordinate)
print("coordinate: ", map_coordinate)
Thank you for your Help.