auto-git:

[change] src/runtime-three/runtime-host.ts
This commit is contained in:
2026-04-25 03:53:24 +02:00
parent b5a14c8c43
commit f9e4e3a079

View File

@@ -312,6 +312,9 @@ const CAMERA_RIG_GAMEPAD_LOOK_SPEED = 2.2;
const DIALOGUE_ATTENTION_CAMERA_TRANSITION_DURATION_SECONDS = 0.35;
const DIALOGUE_ATTENTION_PLAYER_FOCUS_HEIGHT_FACTOR = 0.82;
const DIALOGUE_ATTENTION_NPC_FOCUS_HEIGHT_FACTOR = 0.88;
const DIALOGUE_PARTICIPANT_MIN_SURFACE_DISTANCE = 0.5;
const DIALOGUE_PARTICIPANT_YAW_BLEND_RATE = 8;
const DIALOGUE_PARTICIPANT_RESTORE_EPSILON_DEGREES = 0.5;
function dampScalar(current: number, target: number, rate: number, dt: number) {
return current + (target - current) * Math.min(1, dt * rate);
@@ -321,6 +324,29 @@ function clampScalar(value: number, min: number, max: number) {
return Math.max(min, Math.min(max, value));
}
function normalizeDegrees(value: number) {
const wrapped = ((value + 180) % 360 + 360) % 360 - 180;
return wrapped === -180 ? 180 : wrapped;
}
function resolveShortestAngleDeltaDegrees(fromDegrees: number, toDegrees: number) {
return normalizeDegrees(toDegrees - fromDegrees);
}
function dampAngleDegrees(
currentDegrees: number,
targetDegrees: number,
rate: number,
dt: number
) {
return normalizeDegrees(
currentDegrees +
resolveShortestAngleDeltaDegrees(currentDegrees, targetDegrees) *
Math.min(1, dt * rate)
);
}
function isNonNull<T>(value: T | null): value is T {
return value !== null;
}