Search After Losing a Target

Goal

Use this pattern to keep searching for a short time after sight is lost, then return to normal behavior.

Tree structure

Place Chase first, Search second, and Patrol last under a Selector. Make Chase and Search Sequences whose first child tests whether that branch is currently valid.

A Selector prioritizes Chase, then Search at the last known position, then Patrol as the fallback.

How it runs

While the target is visible, store its position in a Last Known Position Shared Variable. Set the Chase Sequence’s Abort Type to Both so losing sight stops Chase and seeing the target again interrupts Search or Patrol.

After sight is lost, Chase fails and the Selector enters Search. The project-specific Search Briefly Action remains Running for a finite duration. If it does not reacquire the target, it clears Last Known Position and returns Failure so the Selector enters Patrol.

Variations

Clear Last Known Position when the search ends. Add several generated search points when the movement system supports a local investigation pattern.

Tasks used in this tree

Selector, Sequence, a project-specific Search Action, Variables, and Conditional Aborts.