Vixen
c7401864
csharp
public struct AiFocus

What an agent is paying attention to.

Read the guide page for this →

Remarks

Unreal's focus, and its value is that everything downstream reads one place. A rotation task, an aim offset, a head-look constraint and a dialogue camera all want "what is this character looking at", and without a component for it each of them takes its own blackboard key and they disagree the first time one branch sets a key another does not.

⚠ An entity or a point, and the entity wins. A focus on an entity follows it as it moves; a focus on a point does not. Two fields rather than a discriminated one because Null already means "there is no entity", so the tag would be a second copy of a fact the value carries.

Fields and properties (3)

  • public Entity Target

    What it is looking at, or Null for Point.

  • public Vector3 Point

    Where it is looking, when there is no target.

  • public bool HasFocus

    Whether it is looking at anything at all.

Methods (3)

  • public readonly bool TryResolve(World world, out Vector3 position)

    Where the focus is now, following the target if there is one.

  • public static AiFocus On(Entity target)

    A focus on an entity.

  • public static AiFocus At(Vector3 point)

    A focus on a place.

Used by (6)

  • AgentTargetVixen.Ai.Nodes
  • DefaultFocusServiceVixen.Ai.Nodes
  • FocusTestsVixen.Ai.Nodes.Tests
  • RotateTowardTestsVixen.Ai.Nodes.Tests
  • TypeRegistrationVixen.Ai.Nodes
  • Vixen_Ai_Nodes_Ecs_AiFocusSerializerVixen.Ai.Nodes