Tala Esenlikler

Initial UE 5.7 release

Focus And Spatial Queries

How interactors find nearby registered points, score focus, and avoid unstable focus switching.

Interaction Framework 1.0.0 UE5.7

How Candidate Queries Start

Targets become focus candidates only after UInteractionRuntimeTargetComponent registers their authored points with UInteractionRuntimeWorldSubsystem. The interactor resolves a distance origin, asks the world subsystem for nearby handles, and then scores the handles. A target actor that has no target component, no definition, no valid point id, or no registered point state will not enter the focus candidate set.

Spatial Grid Behavior

The world subsystem stores registered points in a spatial grid. The runtime uses a 1200 cm grid cell size and a 120 cm cell hysteresis margin. Candidate queries expand by the largest relevant interaction range, collect candidate handles from matching cells, then sort by distance before focus scoring. This prevents every interactor from checking every registered point in the world each frame.

Focus Score Inputs

Focus scoring uses distance, view direction, and point priority. Distance contributes through FocusDistanceWeight. View alignment contributes through FocusViewWeight. The authored point focus priority weight can make one point win over another when both are valid. Candidates are rejected before scoring when target or point state is disabled, proximity data is missing, the candidate is out of range, command visibility does not qualify, or the view dot does not meet the authored threshold.

Point Of Interest Ranges

Point-of-interest behavior lets a point stay relevant while the player moves around it. Use this when prompts should not immediately vanish at the exact interaction boundary, such as a door handle, control panel, pickup, or shared prompt surface. If a point is too sticky, lower the relevant range or adjust focus hold and switch margin before changing UI code.

Focus Stability

FocusMinHoldSec controls how long current focus is held before switching. FocusSwitchScoreMargin requires a new candidate to beat the current candidate by a margin. Together, these settings reduce flicker when several points are near each other or when the player camera moves across a boundary.

Performance Controls

MaxFocusQueryCandidates and query-budget settings control how many candidates the runtime evaluates. If a dense scene has many interactable points, reduce unnecessary point ranges and keep authored points tied to meaningful interaction locations. Large proximity ranges increase the candidate set and make focus less predictable.

Tuning Sequence

  1. Verify point bindings and transforms before changing scoring values.
  2. Set point interaction range to the physical activation distance.
  3. Set point-of-interest range to the distance where prompts should remain understandable.
  4. Adjust view thresholds so objects behind or beside the player do not win focus.
  5. Tune distance and view weights only after authored point ranges are correct.
  6. Increase hold time or score margin if focus flickers between valid points.

Dense Scene Guidance

Dense scenes need tighter authored points. Avoid giving every object a wide all-purpose range. Bind points to meaningful scene components, keep ranges close to the physical affordance, and use point priority only for genuine design priority. If every object has a high priority, priority stops being useful.

Focus Debug Examples

  • A wall switch behind the player wins focus: raise view threshold or view weight.
  • A nearby pickup wins over the looked-at panel: reduce distance weight, increase panel priority, or tighten pickup range.
  • Focus flickers between two handles: increase hold time or score margin and reduce overlapping ranges.
  • Focus never reaches a child component: verify point binding and distance origin.

Authoring Versus Settings

Use point-level data for object-specific problems. Use developer settings for project-wide feel. If only one target is wrong, changing global focus weights will make other targets worse.