0 votes

Move mouse with controller :v

asked Jun 6 in Engine by ManiCus (78 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) 
answered Jun 6 by estebanmolca (1,199 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.

answered Jun 6 by muratbozkurt35 (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.