LCM Nav3D Free demo Get it on Fab

Tutorial 13 - LCM Fly To Location (no Behavior Tree, no StateTree)

TL;DR: LCM Fly To Location is the flying counterpart of the engine's AI Move To node. Call it from any Blueprint - a level script, a pawn's Event Graph, a widget - with a pawn and a destination, and it fires On Success when the pawn arrives or On Fail with the reason it did not. The pawn needs no AI Controller, no Behavior Tree and no StateTree.

What you need

Using the node

  1. Right-click in a Blueprint graph and search for LCM Fly To Location (category LCM Nav3D | Movement).
  2. Connect Pawn and Destination.
  3. Handle the two exec pins:
    • On Success - the pawn has arrived.
    • On Fail - it has not; the Result pin says why.

Both pins also give Pawn Location, where the pawn was when the request ended.

Input Default Meaning
Pawn - The pawn to fly.
Destination - Where to go. Ignored when Target Actor is set.
Target Actor none Fly to this actor instead, re-planning as it moves.
Acceptance Radius -1 Arrival distance in cm. <= 0 uses the Fly To default (100 cm, times the agent scale).
Filter Class (advanced) none A navigation query filter: which cost areas this pawn avoids or prefers (Tutorial 10).
Chase Moving Target (advanced) off Aim where a moving Target Actor is going, not where it is.
Flight Speed (advanced) -1 Kinematic pawns only: cruise speed in cm/s. <= 0 uses the default.
Timeout Seconds (advanced) 0 Give up after this long. <= 0: no limit.
Result Pin When
Success On Success Arrived.
No Path On Fail The destination cannot be reached from where the pawn is: sealed, outside the navigable volume, or excluded by the filter.
Failed On Fail The pawn set off but could not complete the route.
Aborted On Fail Cancelled, stopped, or replaced by a newer request for the same pawn.
Timed Out On Fail Ran longer than Timeout Seconds.
Invalid Request On Fail No pawn, or no LCM Nav3D Manager in the pawn's world. Fires at once.

Stopping and replacing

A stopped 6-DOF pawn holds where it was stopped rather than cruising on its last command. A body that cannot stop dead - a fish, a bird - glides its stopping distance and comes back. Measured on the demo fish: at most 4-7 cm past the cancel point, and settled within 2 cm of it 4 s later.

How arrival is judged

One Fly To, not three

The node has no movement code of its own. It runs the StateTree Fly To task's own code - the same planner, cost areas, re-planning, streaming waits, avoidance, speed governor, arrival and flight-component hand-off. A pawn flies the same whether a tree or this node sends it.

Do not drive one pawn from two places at once. A pawn running a Fly To task in a Behavior Tree or StateTree and an LCM Fly To Location at the same time has two sources of guidance; the last one each frame wins. Stop the tree's task (or leave the pawn without a tree) before using the node on it.

From C++

#include "Agent/LCM_FlyToAsyncAction.h"

ULcmFlyToLocationAsyncAction* Fly = ULcmFlyToLocationAsyncAction::FlyToLocation(
    this, MyPawn, FVector(4500, -2000, 800));
Fly->OnSuccess.AddDynamic(this, &AMyActor::HandleArrived);   // UFUNCTION(ELcmFlyToResult, FVector)
Fly->OnFail.AddDynamic(this, &AMyActor::HandleNotArrived);
Fly->Activate();

In C++, bind the delegates before calling Activate(): an invalid request fires On Fail inside Activate(). The Blueprint node does this for you.

Verified

The battery gate g35_flyto_node (-run=LcmNavCostTest -Group=FlyToNode) flies a pawn with no controller through the demo fish tank at a 1 cm leaf and the stock navigator pawn across the metre-scale cost showcase. It checks every case above: an invalid request, arrival and a single On Success, never inside rock or glass, No Path, replacement, Cancel and hold, a chase to a moving actor.