From 85a7b0156355b7b7e2c91f227115856361cc2995 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Thu, 2 Apr 2026 20:08:45 +0200 Subject: [PATCH] Update audio distance gain calculation --- src/runtime-three/runtime-audio-system.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/runtime-three/runtime-audio-system.ts b/src/runtime-three/runtime-audio-system.ts index 7cea7cf0..69608b02 100644 --- a/src/runtime-three/runtime-audio-system.ts +++ b/src/runtime-three/runtime-audio-system.ts @@ -46,9 +46,10 @@ export function computeSoundEmitterDistanceGain(distance: number, refDistance: n const normalizedDistance = (distance - refDistance) / (maxDistance - refDistance); const clampedDistance = Math.min(1, Math.max(0, normalizedDistance)); - const smoothStep = clampedDistance * clampedDistance * (3 - 2 * clampedDistance); + const proximity = 1 - clampedDistance; + const easedProximity = proximity * proximity * proximity * proximity; - return 1 - smoothStep; + return easedProximity; } export class RuntimeAudioSystem {