top of page
  • Linkedin logo
  • Colour Collide Icon

Patrol System

The patrol system involves entities that 'patrol', through the use of 'routes' and 'patrol points'.

Patrol Component, responsible for controlling overall movement and flow. Responsible for making use of routes & patrols while storing necessary information regarding self involvement. (Will this agent wait at an occupied point, or how long have they spent at the patrol point. Which route is being used etc.)

Route:​​

  • a collection of Patrol Points

  • Patrolling NPC's stay on the same route when undisturbed

  • Can have multiple entities patrolling a single route at any time

  • allows NPC's to loop back and fourth through the collection of patrol points

    • supported both traversing backwards through points​

    • and looping back to the first point

  • Allows NPC's to connect to the next point, such as to see if a patrol point is occupied

Patrol Point:

  • Represent a position & rotation that the patrolling entity will stand at

  • A duration until moving onto the next point (unless set to a stationary point - indefinite)

  • Stores a reference to occupant

  • Used alongside Unity's nav mesh to move agents 

Custom Tool

The Custom tool is responsible for easier placement of patrol paths. The tool is responsible for quick initial placement, leaving points to be further adjusted in the hierarchy if necessary.

PatrolPoint custom tool image.jpg

Left click to place, drag for rotation

Gizmos

White line represents orientation and red connects the patrol points.

Below shows how toggling between 'loop' and 'inverse' is represented by the red line.

The cyan line below shows where the nearest Navmesh is, this is useful for confirming where the AI would go for each point. On the left a magenta sphere can be seen to indicate there is not a nearby navmesh.

magenta sphere - out of range

Cyan line - in range of navmesh

Editor + Extras

The system can place routes & points with shortcuts, automatically setting up dependencies during placement.

Gizmos are used to more easily display information. (a route's patrol points rotation/position)

AI can also request the nearest route for convenience, both when placing new NPC's or spawning them during runtime. This allowed automatically linking to a patrol route unless otherwise specified.

Undo operations are supported*

© 2023 by Site Name. Proudly created with Wix.com

bottom of page