From 3d91477d4cf992e37a6f03b6d58db8b995702421 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sat, 25 Apr 2026 18:03:06 +0200 Subject: [PATCH] Improve runtime target selection by filtering candidates based on camera and player visibility --- src/runtime-three/runtime-host.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/runtime-three/runtime-host.ts b/src/runtime-three/runtime-host.ts index bec3a6dd..7736cb08 100644 --- a/src/runtime-three/runtime-host.ts +++ b/src/runtime-three/runtime-host.ts @@ -5627,7 +5627,7 @@ export class RuntimeHost { }, runtimeScene: this.runtimeScene, previousProposedTargetEntityId: previousProposedId - }); + }).filter((candidate) => this.isRuntimeTargetCameraVisible(candidate)); if ( this.activeRuntimeTargetReference !== null && @@ -5637,8 +5637,12 @@ export class RuntimeHost { } this.proposedRuntimeTarget = - this.resolveRuntimeTargetCandidateNearestScreenCenter() ?? - this.runtimeTargetCandidates[0] ?? + this.resolveRuntimeTargetCandidateNearestScreenCenter({ + requirePlayerVisibility: true + }) ?? + this.runtimeTargetCandidates.find((candidate) => + this.isRuntimeTargetPlayerVisible(candidate) + ) ?? null; }