From 1765b2322898743e318985ed105d8d9f47d4d527 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sat, 25 Apr 2026 18:05:48 +0200 Subject: [PATCH] Implement target lock release upon prolonged occlusion --- src/runtime-three/runtime-host.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/runtime-three/runtime-host.ts b/src/runtime-three/runtime-host.ts index 577ffc74..26cddfd6 100644 --- a/src/runtime-three/runtime-host.ts +++ b/src/runtime-three/runtime-host.ts @@ -5945,7 +5945,7 @@ export class RuntimeHost { return false; } - private updateActiveRuntimeTargetLockState() { + private updateActiveRuntimeTargetLockState(dt = 0) { if ( this.activeRuntimeTargetReference === null || this.currentPlayerControllerTelemetry === null || @@ -5961,6 +5961,20 @@ export class RuntimeHost { return; } + if (this.isRuntimeTargetCameraVisible(activeTarget)) { + this.activeRuntimeTargetOcclusionSeconds = 0; + } else { + this.activeRuntimeTargetOcclusionSeconds += Math.max(0, dt); + + if ( + this.activeRuntimeTargetOcclusionSeconds >= + TARGETING_ACTIVE_OCCLUSION_GRACE_SECONDS + ) { + this.setActiveRuntimeTargetReference(null); + return; + } + } + if ( distanceBetweenPoints( this.currentPlayerControllerTelemetry.eyePosition,