Hello guys :) :
I'm learning the warpmouseposition(to: Vector2) method and I don't know why, but I can't make the mouse to warp in the desire position, this is my tree scene:
Node2d (parent) (script)
onready var Area2d_n := $Area2d
onready var Collisionshape2d_n:=$Collisionshape2d
onready var position_1:Vector2= $Area2d.global_position
func _on_Defense_Area_mouse_exited() -> void:
these are the transforms position of the nodes:
Collisionshape2d= (0,0) relative to his parent Area2d
So my intention is to limit the mouse position. When the mouse leaves the Area2d go back to the center of the Area2d. But it adds a weird offset, and even trying this code:
onready var position_1:Vector2= $Area2d.get_global_transform_with_canvas().origin
Still give me a weird offset that is closest to 0,0 and not in the center of the Area2d center position. Anyone knows why and how to fix it?
Thanks a lot.