# How to set orbit camera left and right limit

Hey guys, I want to restrict the maximum limit of left and right not rotate further
can anyone help?

1 Like

Only pitch (up / down) is clamped, you would need to extend the orbit camera or do some prototype overwriting:

1 Like

thanks for telling I am weak in a concept of programming i am create a configurator where the product i want the 180 deg only left and right side should you tell me the code what i write that?

1 Like

@ateeque

You can just add this in F12/DevTools:

``````OrbitCamera.prototype.update = function (dt) {
var t = this.inertiaFactor === 0 ? 1 : Math.min(dt / this.inertiaFactor, 1);
this._distance = pc.math.lerp(this._distance, this._targetDistance, t);

this._targetYaw = pc.math.clamp(this._targetYaw, -100, -50);
this._yaw = pc.math.lerp(this._yaw, this._targetYaw, t);
console.log("yaw is", this._yaw);
this._pitch = pc.math.lerp(this._pitch, this._targetPitch, t);

this._updatePosition();
};
``````

Line 6 says â€śclamp between -100 and -50â€ť, which you can just fix for your needâ€¦ you have to work with negative numbers here, based on this comment:

``````OrbitCamera.prototype._clampPitchAngle = function (pitch) {
// Negative due as the pitch is inversed since the camera is orbiting the entity
return pc.math.clamp(pitch, -this.pitchAngleMax, -this.pitchAngleMin);
};
``````
1 Like

Thank you @kungfooman yeh its work.