NavAgentComponent struct in Thread

A pathfinding agent. The navigation system paths from the entity's position to Target across the baked NavMesh and writes the sibling CharacterControllerComponent's DesiredVelocity to steer along it. Requires a TransformComponent and a CharacterController on the same entity.

Steering

SpeedfloatMovement speed along the path (m/s).
StoppingDistancefloatStop within this XZ distance of the goal.
WaypointRadiusfloatAdvance to the next waypoint within this distance.
RepathIntervalfloatSeconds between path recomputes while moving.

Command & state

TargetVec3Destination in world space.
HasTargetboolSet true to start moving; cleared when arrived.
ArrivedboolRuntime read-only — true once within StoppingDistance.
Pathstd::vector<Vec3>Runtime waypoint list (not serialized).

Example (from a script)

void OnUpdate(float ts) override {
    auto& agent = GetComponent<Thread::NavAgentComponent>();
    agent.Target    = m_Player.GetComponent<Thread::TransformComponent>().Translation;
    agent.HasTarget = true;   // the nav system does the steering
}

For decision logic on top of movement, drive the agent from a BehaviourTreeComponent (its MoveTo task sets Target).

NavAgentComponent struct w Thread

Agent wyszukiwania ścieżek. System nawigacji wyznacza ścieżkę od pozycji encji do Target po wypieczonym NavMeshu i ustawia DesiredVelocity sąsiedniego CharacterControllerComponent, żeby nią podążać. Wymaga TransformComponent i CharacterController na tej samej encji.

Sterowanie

SpeedfloatPrędkość ruchu po ścieżce (m/s).
StoppingDistancefloatZatrzymaj się w tej odległości XZ od celu.
WaypointRadiusfloatPrzejdź do następnego punktu po zbliżeniu się na tę odległość.
RepathIntervalfloatSekundy między ponownymi wyliczeniami ścieżki w ruchu.

Polecenie i stan

TargetVec3Cel w przestrzeni świata.
HasTargetboolUstaw true, żeby ruszyć; czyszczone po dotarciu.
ArrivedboolTylko do odczytu w czasie działania — true po wejściu w StoppingDistance.
Pathstd::vector<Vec3>Lista punktów w czasie działania (nie zapisywana).

Przykład (ze skryptu)

void OnUpdate(float ts) override {
    auto& agent = GetComponent<Thread::NavAgentComponent>();
    agent.Target    = m_Player.GetComponent<Thread::TransformComponent>().Translation;
    agent.HasTarget = true;   // sterowaniem zajmie się system nawigacji
}

Logikę decyzji nad ruchem daje BehaviourTreeComponent (jego zadanie MoveTo ustawia Target).