From 5d5b7827607ee3a8ecb3cfc2247b46edaddcf431 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Mon, 28 Apr 2025 21:36:35 +0700 Subject: [PATCH] only update camera when there's change --- .../app/src/pages/PageEnigma/Editor/free_cam.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/frontend/apps/editor3d/app/src/pages/PageEnigma/Editor/free_cam.ts b/frontend/apps/editor3d/app/src/pages/PageEnigma/Editor/free_cam.ts index 535e7190c4..aeb9927c66 100644 --- a/frontend/apps/editor3d/app/src/pages/PageEnigma/Editor/free_cam.ts +++ b/frontend/apps/editor3d/app/src/pages/PageEnigma/Editor/free_cam.ts @@ -271,7 +271,10 @@ class FreeCam extends EventDispatcher { } isStationary() { - return this.moveVector.distanceTo(new Vector3(0, 0, 0)) === 0; + return ( + this.moveVector.distanceTo(new Vector3(0, 0, 0)) === 0 && + this.currentVelocity.distanceTo(new Vector3(0, 0, 0)) < 0.0001 + ); } update(delta: number) { @@ -279,6 +282,11 @@ class FreeCam extends EventDispatcher { return; } + // Skip update if there's no movement and velocity + if (this.isStationary()) { + return; + } + const moveMulti = delta * this.movementSpeed; // Apply WASD movement with smoothing