Controller emulating mouse

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By deathbeyond

Hello fellow Godot users, I have a quick question. How would I make a controller’s right stick emulate the mouse? I know warpmouseposition exists in the Input singleton but I’m not entirely sure how to calculate the Vector and such.

:bust_in_silhouette: Reply From: Magso

Use get_action_strength for the joystick directions and += that to a vector2 variable.

var mouse_pos : vector2
mouse_pos += vector2(Input.get_action_strength("joy left") + Input.get_action_strength("joy right"), Input.get_action_strength("joy up") + Input.get_action_strength("joy down"))
Input.warp_mouse_position(mouse_pos)