From fc4112df5c09f883eb9f4d0209f9c7fa5af2911a Mon Sep 17 00:00:00 2001 From: kpal Date: Fri, 15 Nov 2024 16:08:14 +0000 Subject: [PATCH] Fixed potential near clip issue --- scripts/camera-controls.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/camera-controls.mjs b/scripts/camera-controls.mjs index 2d38efe682c..fe32f22d672 100644 --- a/scripts/camera-controls.mjs +++ b/scripts/camera-controls.mjs @@ -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); }