Improve runtime target selection by filtering candidates based on camera and player visibility

This commit is contained in:
2026-04-25 18:03:06 +02:00
parent 31b0a5b808
commit 3d91477d4c

View File

@@ -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;
}