Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | MikeSundaysGameDev |
Hi,
Last day I was making a joystick handle that would follow the mouse when clicked. To get the local position of the mouse position relative to the joystick background node(which I had to for my algorithm to clamp the max distance the handle could go) I used background.transform.xform_inv, but, unfortunately, it didn’t work. So i tried using background.to_local which,surprisingly, worked. Now my question is: Isn’t node.transform.xform_inv supposed to do the same as Node.to_local? Or am I missing something?
Btw the Node architecture i was using was the following: Player(Node2D) ->TouchControls(Canvas Layer) → Joystick(Area2D) → Background(TouchScreenButton) → Handle(Sprite)
Thanks in advance for any help in clarifying this question,