0 votes

Hi,
I'm trying to move a kinematicbody2d inside a tilemap inside canvaslayer to a mouse click. When I use set_pos(event.pos)
everything works fine. However, I can't do that with move_to (the node is not moved to correct coords) , so I have to use

move_to(event.global_pos)

instead. Question is - why can't move_to accept event.pos?

Thanks

asked Jan 9, 2018 in Engine by Antonb (61 points)

1 Answer

0 votes

I managed to convert the coordinates from local to global using:

get_node("/root/global").player_pos = self.get_global_transform().xform(event.pos)
answered Jan 10, 2018 by Antonb (61 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.