Disable a pan axis in OrbitControls

This heavily depends on the use case… For a very basic and simple example, something like this does the trick:

orbit.addEventListener( 'change', function(){
    if (this.target.x < -1){
        this.target.x = -1;
        camera.position.x = -1;
    } else if (this.target.x > 1){
        this.target.x = 1;
        camera.position.x = 1;
    }
})

1 Like