What exactly is
The CanvasItem global mouse returns coordinates based on the viewport, and the local method is based on the CanvasItem’s local coordinates. So it’s relative from it’s origin.
If you have a node that’s a canvas item, and it lives at 100, 100. If you point your mouse in the center of it, global coordinates should report as 100, 100, and local will be 0, 0, the origin of the node.
event from the func _input(event) callback
there is event.pos and event.global_pos and i was wondering that both seems to be the same.
i would expect that event.pos is affected from the viewport transform or from that node´s transform where the script attached is.
get_global_mouse_pos gives me what i want, so far so good, but it leaves me with some questions:
Global means… yeah global? there where in the Godot Editor the two orthogonal lines intersect, an absolut reference point with the values 0,0 the origin of the big bang
How would a scene be designed where any node with a _input callback gives different values for event.pos and event.global_pos?
molamar | 2016-10-22 20:44
Oh the positions for the mouse click events.
As far as I can tell, it’s as you say, the same thing. I suppose maybe it’s just a redundancy. Anytime I’ve encountered a pos() without any local or global prefix, it’s been an absolute position.
I was thinking maybe sub-viewports might report differently, but the unhandled mouse clicks don’t seem to register in them. So I can’t think of a situation where you could get these values to diverge.
avencherus | 2016-10-22 22:59