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.

in Engine by (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)
by (3,219 points)
selected by
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.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.