Skip to content

Commit

Permalink
Fixed potential near clip issue
Browse files Browse the repository at this point in the history
  • Loading branch information
kpal81xd committed Nov 15, 2024
1 parent c40a184 commit fc4112d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/camera-controls.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ class CameraControls extends Script {
* @returns {number} - The clamped value.
*/
_clampZoom(value) {
const min = this._camera.nearClip + this.zoomMin * this.sceneSize;
const min = (this._camera?.nearClip ?? 0) + this.zoomMin * this.sceneSize;
const max = this.zoomMax <= this.zoomMin ? Infinity : this.zoomMax * this.sceneSize;
return math.clamp(value, min, max);
}
Expand Down

0 comments on commit fc4112d

Please sign in to comment.