From 1bb528bce19cf9b708b5607a714d3d3eb45ab64b Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sat, 25 Apr 2026 18:36:28 +0200 Subject: [PATCH] Implement sway effect for lux target position --- src/runtime-three/runtime-host.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/runtime-three/runtime-host.ts b/src/runtime-three/runtime-host.ts index 63d0702e..fd9a1e2d 100644 --- a/src/runtime-three/runtime-host.ts +++ b/src/runtime-three/runtime-host.ts @@ -6315,13 +6315,23 @@ export class RuntimeHost { this.targetingVisualTime += dtSeconds; const visualPlacement = resolveRuntimeTargetVisualPlacement(visualTarget); const bob = Math.sin(this.targetingVisualTime * TARGETING_LUX_BOB_RATE) * 0.08; + const sway = + Math.sin(this.targetingVisualTime * TARGETING_LUX_SWAY_RATE) * + TARGETING_LUX_SWAY_DISTANCE; const pulse = 1 + Math.sin(this.targetingVisualTime * TARGETING_LUX_PULSE_RATE) * 0.12; + this.targetingLuxSwayDirection + .setFromMatrixColumn(this.camera.matrixWorld, 0) + .normalize(); this.targetingLuxTargetPosition.set( visualPlacement.luxPosition.x, visualPlacement.luxPosition.y + bob, visualPlacement.luxPosition.z ); + this.targetingLuxTargetPosition.addScaledVector( + this.targetingLuxSwayDirection, + sway + ); if ( !this.targetingLuxInitialized ||