Jittery camera movement with controller

I tried setting up movement with a controller and it’s working fine except for the camera that sometimes jitters while rotating. I’m trying to use the right stick of an xbox controller for it.
Is there a “standard” way of moving the camera with the sticks? I’m using the mouse movement presented in the course as a base but maybe that isn’t the right way to go, any hint would be appreciated.

Hi,

I think you are supposed to use Input.get_action_strength so that it uses how far you are pushing the the stick to control the speed of rotation.
I dont think this would cause the stuttering though.

I would set up the controller inputs seperately and use the following code.

extends Camera

var rotation_speed = 0.1

func _process(delta):
    # Get the input value for the camera rotation
    var input_x = Input.get_action_strength("rotate_camera_left") - Input.get_action_strength("rotate_camera_right")
    var input_y = Input.get_action_strength("rotate_camera_up") - Input.get_action_strength("rotate_camera_down")

    # Rotate the camera based on input
    rotate_y(-input_x * rotation_speed)
    rotate_x(-input_y * rotation_speed)

Hope this helps

1 Like

Thanks, it helped to hack a solution for the moment!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms