0 votes

Move mouse with controller :v

in Engine by (103 points)

2 Answers

0 votes

I don't have a joystick to test it but this should work (works fine with arrows):

var mouse_sens= 300.0

    func _physics_process(delta):
        var direction: Vector2
        direction.x = Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left")
        direction.y = Input.get_action_strength("ui_down") - Input.get_action_strength("ui_up")


        if abs(direction.x) == 1 and abs(direction.y) == 1:
            direction = direction.normalized()

        var movement = mouse_sens * direction * delta
        if (movement):  
            get_viewport().warp_mouse(get_global_mouse_position()+movement) 
by (2,010 points)
0 votes

https://godotengine.org/qa/5878/set-mouse-position

you can use this i suppose.
use controller input to add or substract x and y values to mouse position instead adding motion to character.

by (26 points)
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.