0 votes

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.

asked Jan 9 in Engine by deathbeyond (15 points)

1 Answer

+1 vote
Best answer

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)
answered Jan 9 by Magso (2,867 points)
selected Jan 9 by deathbeyond
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.