Godot Version
Godot 4.1.2.stable.mono.official
Question
Hey everyone!
I need some help debugging this issue I’m having with the Input.warp_mouse function. I’m trying to move the cursor using a gamepad. It works very well if I don’t resize my screen, in fact it even works as expected when i resize the window horizontally. However when i resize the window vertically the cursor suddenly starts moving very fast, shooting up or down to the corners of the screen.
Here’s my code:
PS: the values i get from the speed curve are consistent when i resize the screen, the curPos value passed into the warp_mouse function is correct.
var input_direction : Vector2 = Input.get_vector("move_left", "move_right", "move_up", "move_down")
input_direction = input_direction.normalized()
if input_direction.length() > 0.0:
var curPos : Vector2 = get_global_mouse_position()
curPos.x += input_direction.x * delta * cursorSpeedCurve.sample_baked(moveTime) * cursorSpeedBase
curPos.y += input_direction.y * delta * cursorSpeedCurve.sample_baked(moveTime) * cursorSpeedBase
moveTime += delta
Input.warp_mouse(curPos)
Thank you all in advance!