From 1ad52fd3c3dd86a22e0a80c068bf935177f51ec2 Mon Sep 17 00:00:00 2001 From: 134 Date: Sun, 21 Jun 2026 11:57:06 +0800 Subject: [PATCH] fix: reduce 3d world movement step --- components/canvas/model3d/Model3DViewer.tsx | 7 ++++++- components/canvas/world3d/World3DViewer.tsx | 12 ++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/components/canvas/model3d/Model3DViewer.tsx b/components/canvas/model3d/Model3DViewer.tsx index c4acd13cf..73fb8960a 100644 --- a/components/canvas/model3d/Model3DViewer.tsx +++ b/components/canvas/model3d/Model3DViewer.tsx @@ -104,6 +104,8 @@ const CAMERA_PRESET_POSITIONS: Record< }; const KTX2_TRANSCODER_PATH = "/three/basis/"; +const MODEL_MOVE_SPEED = 1.05; +const MODEL_MAX_FRAME_MOVE_DISTANCE = 0.035; function CameraPresetController({ controlsRef, @@ -512,7 +514,10 @@ function ModelMovementControls({ if (pressed.down) moveRef.current.addScaledVector(upRef.current, -1); if (moveRef.current.lengthSq() === 0) return; - const distance = 2.6 * delta; + const distance = Math.min( + MODEL_MOVE_SPEED * delta, + MODEL_MAX_FRAME_MOVE_DISTANCE + ); moveRef.current.normalize().multiplyScalar(distance); camera.position.add(moveRef.current); if (orbitControlsRef.current?.target) { diff --git a/components/canvas/world3d/World3DViewer.tsx b/components/canvas/world3d/World3DViewer.tsx index 065623f30..d099421fc 100644 --- a/components/canvas/world3d/World3DViewer.tsx +++ b/components/canvas/world3d/World3DViewer.tsx @@ -205,6 +205,9 @@ const SPARK_MIN_SORT_INTERVAL_MS = 24; const SPARK_MINIMAL_FRAME_SORT_INTERVAL_MS = 40; const SPARK_SPLAT_FETCH_TIMEOUT_MS = 150_000; const SPARK_SPLAT_LOAD_TIMEOUT_MS = 45_000; +const WORLD_FIRST_PERSON_MOVE_SPEED = 1.35; +const WORLD_ORBIT_MOVE_SPEED = 1.05; +const WORLD_MAX_FRAME_MOVE_DISTANCE = 0.04; const KEY_TO_MOVEMENT: Partial> = { KeyW: "forward", @@ -1147,8 +1150,13 @@ function CameraMovementControls({ Boolean(padPressed && Object.values(padPressed).some(Boolean)); if (!hasMovement) return; - const moveSpeed = firstPerson ? 3.8 : 2.8; - const distance = moveSpeed * delta; + const moveSpeed = firstPerson + ? WORLD_FIRST_PERSON_MOVE_SPEED + : WORLD_ORBIT_MOVE_SPEED; + const distance = Math.min( + moveSpeed * delta, + WORLD_MAX_FRAME_MOVE_DISTANCE + ); camera.getWorldDirection(directionRef.current); directionRef.current.setY(0).normalize();