fix: reduce 3d world movement step
This commit is contained in:
parent
618bc2bd97
commit
1ad52fd3c3
@ -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) {
|
||||
|
||||
@ -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<Record<string, MovementCommand>> = {
|
||||
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();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user