BT
Node builders (composite / decorator / task vocabulary)
- Module
- AINavigation
- Header
#include "AINavigation/BehaviorTree.h"- Namespace
Mowo
Type aliases
| Alias | Description |
|---|---|
using NodePtr = std::unique_ptr<BTNode> |
Public functions
| Returns | Name | Description |
|---|---|---|
NodePtr | Selector | Composites |
NodePtr | Sequence | first non-Success child stops |
NodePtr | Inverter | Decorators (wrap one child) |
NodePtr | BlackboardBool | gate on a bb bool |
NodePtr | Gate | Generic gate: condition decides, observedKeys name what can change it. |
NodePtr | TimeLimit | Fails the child (aborting it) once it has run longer than seconds. |
NodePtr | Wait | Tasks (leaves) |
NodePtr | Func | arbitrary leaf logic |
NodePtr | SetBlackboardBool | set + Success |
NodePtr | SetBlackboardInt | set + Success |
NodePtr | Parallel | More composites / decorators |
NodePtr | Service | run fn every interval while child active |
NodePtr | Cooldown | block (Failure) for seconds after each completion |
NodePtr | Loop | repeat child count times (0 = forever, yields each iter) |
NodePtr | MoveTo | Nav task: drive the AIController's possessed pawn's NavAgentComponent toward the Vec3 in blackboard destKey. |
NodePtr | FindCover | Cover tasks (implemented in CoverSystem.cpp, backed by FCoverSystem). |
NodePtr | MoveToCover | |
NodePtr | InCover | |
NodePtr | LeaveCover | |
NodePtr | MeleeAttack | Melee task (implemented in MeleeSystem.cpp, backed by FMeleeSystem). |
Function details
Selector
static NodePtr Selector(std::vector<NodePtr> children)Composites
Sequence
static NodePtr Sequence(std::vector<NodePtr> children)first non-Success child stops
Inverter
static NodePtr Inverter(NodePtr child)Decorators (wrap one child)
BlackboardBool
static NodePtr BlackboardBool(FName key, bool expected, NodePtr child, EBTFlowAbortMode abortMode = EBTFlowAbortMode::None)gate on a bb bool
Gate
static NodePtr Gate(std::function<bool(BTContext&)> condition, std::vector<FName> observedKeys, NodePtr child, EBTFlowAbortMode abortMode = EBTFlowAbortMode::None)Generic gate: condition decides, observedKeys name what can change it.
TimeLimit
static NodePtr TimeLimit(float seconds, NodePtr child)Fails the child (aborting it) once it has run longer than seconds.
Wait
static NodePtr Wait(float seconds)Tasks (leaves)
Func
static NodePtr Func(std::function<EBTStatus(BTContext&)> fn)arbitrary leaf logic
SetBlackboardBool
static NodePtr SetBlackboardBool(FName key, bool value)set + Success
SetBlackboardInt
static NodePtr SetBlackboardInt(FName key, int value)set + Success
Parallel
static NodePtr Parallel(NodePtr main, std::vector<NodePtr> background)More composites / decorators
Service
static NodePtr Service(float interval, std::function<void(BTContext&)> fn, NodePtr child)run fn every interval while child active
Cooldown
static NodePtr Cooldown(float seconds, NodePtr child)block (Failure) for seconds after each completion
Loop
static NodePtr Loop(int count, NodePtr child)repeat child count times (0 = forever, yields each iter)
MoveTo
static NodePtr MoveTo(FName destKey, float acceptance = 0.0f)Nav task: drive the AIController's possessed pawn's NavAgentComponent toward the Vec3 in blackboard destKey. Running until within acceptance (or the agent reports arrived), then Success; Failure if there's no pawn/agent. acceptance <= 0 uses the agent's stoppingDistance.
FindCover
static NodePtr FindCover(FName threatKey, float maxDistance = 25.0f)Cover tasks (implemented in CoverSystem.cpp, backed by FCoverSystem). FindCover reads the threat position from threatKey, reserves the best point and writes its position to "CoverPosition" + id to "CoverPointId". MoveToCover drives the NavAgent toward the reserved point. InCover is a condition: reserved + not flanked + within acceptance. LeaveCover releases the reservation.
MoveToCover
static NodePtr MoveToCover(float acceptance = 0.75f)InCover
static NodePtr InCover(float acceptance = 1.0f)LeaveCover
static NodePtr LeaveCover()MeleeAttack
static NodePtr MeleeAttack(FName targetKey, float range = 0.0f, float cooldown = 0.0f)Melee task (implemented in MeleeSystem.cpp, backed by FMeleeSystem). Reads the target actor from blackboard targetKey, fails when it is missing or beyond range (0 = the equipped weapon's range), otherwise faces it, requests an attack and stays Running until the swing resolves, then Success. After a completed swing the node reports Failure for cooldown seconds.