I'm trying to rotate my camera when the right joystick on a gamepad moves around, but the result of the code below is a little wonky - does not consistently work. Whenever the axis_value reaches 1 or -1, the camera stops rotating.

var sensitivity = 0.005
func _input(event):
    if event is InputEventJoypadMotion:
        if event.axis == 2:
            rotate_y(-event.axis_value * sensitivity)
        elif event.axis == 3:
            rotate_x(-event.axis_value * sensitivity)
  • xyz replied to this.

    Konlet Don't use events for this. Joystick motion event will trigger only if there is a change in axis value. Once the player pushes the stick to the max and continue holding it, there can't be further changes in value, so _input() will not be called from that point on. Instead, query the axis state each frame in _process() using Input.get_joy_axis()

      xyz I see, thank you! Got it working with get_vector() and controls 🙂