Implement target lock release upon prolonged occlusion

This commit is contained in:
2026-04-25 18:05:48 +02:00
parent 5d07bd853c
commit 1765b23228

View File

@@ -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,