BT TurnInPlace - constant-rate turning, and the stock focus pattern
TL;DR: For continuous "keep facing while doing other
things", use the stock UBTService_DefaultFocus. For a discrete
turn at a constant rate, use LCM_BTTask_TurnInPlace, which
ships with the plugin.
See Look At for the full comparison between the stock rotation task and the LCM Nav3D ones. The short version: the stock task's success test projects onto the XY plane and its applied rotation drops pitch, so on a flying agent with a target overhead it can report success while still pointing level.
Pattern: continuous facing during other tasks
If you want the agent to keep facing a target while executing other tasks in a parent sequence, this is the stock pattern and LCM Nav3D does not replace it:
- Add
UBTService_DefaultFocusto the parent Selector or Sequence. - Set the focus blackboard key (Vector or Object).
- The AIController's focus stays set for the entire subtree, so the pawn
faces the target through
SetFocuswhile other tasks execute.
This is the canonical UE pattern for "shoot while strafing" combat AI.
⚠ A focus service and a rotation task will fight each other. The controller re-asserts focus rotation every tick, overwriting anything a task writes, and this has been observed to stall an agent outright. Use a focus service for continuous facing or a rotation task for a discrete turn, not both on the same subtree.
Pattern: a discrete constant-rate turn
LCM_BTTask_TurnInPlace turns toward the target at
MaxRotationRateDegPerSec and succeeds once it is pointing
within AcceptableErrorDegrees.
Sequence
LCM TurnInPlace (TargetKey = ThreatActor, MaxRotationRateDegPerSec = 180)
<your next task>
Constant rate is the difference from LCM_BTTask_LookAt,
which eases toward the target instead. Use the constant rate when the turn
speed is a character trait you want to be visible and consistent, for
instance a heavy gun platform that traverses slowly. Both tasks share the
same underlying implementation and the same properties otherwise.
bHoldStation defaults on, so the agent holds its position
through the turn rather than drifting.
Property list
See the API
Reference entry for LcmBTTask_TurnInPlace.
On 6-DOF flight bodies
Where LcmFlightMovementComponent is driving the pawn with
the flight dynamics locomotion model, that component owns orientation and
derives it from its own dynamics. The task reports the facing as
unsupported rather than pretending, and still succeeds so surrounding
sequences continue to work. Agents on the default kinematic locomotion
model rotate normally.