Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | fatcat__25 |
I am attempting to make a control inheriting node move with the mouse when clicked and dragged. For this, I need to transform global coordinates into local coordinates in the node’s code. This is the code I’m attempting to use:
func _process(delta):
if Input.is_action_pressed("lclick"):
if moving == true:
var global_position = get_viewport().get_mouse_position()
rect_position = Transform2D.xform_inv(global_position)
It gives me the error Static Constant 'xform_inv' not present in built-in type Transfrom2D
. Additionally, when typing a “.” after Transform2D, autocomplete only offers its constants, not its properties or methods. Why does Godot not allow me to use Transform2D’s methods or properties? Is this a result of my use case? An engine bug? Any help would be appreciated!