Skip to content

NavGrid Agent

Add Component → PlayMaker → NavGrid → NavGrid Agent

NavGridAgent is the main movement component for the NavGrid system.
It moves a GameObject on a NavGrid Asset, using:

  • A pathfinding*
  • Per-cell steering
  • Manual grid-based movement (e.g., player input)

You configure the agent in the Inspector, then control it using NavGridAgent actions.

What the NavGridAgent Does

A NavGridAgent:

  • Knows which NavGrid it should use
  • Keeps track of its current grid cell and direction
  • Can:
    • Pathfind to a Transform (Move To Target)
    • Pathfind to a world position (Move To Position)
    • Move manually one cell at a time (player or AI controlled)
  • Raises events internally (Arrived, No Path, etc.) which PlayMaker actions listen to

Most games will:

  1. Add a NavGridAgent to a character
  2. Assign a NavGrid
  3. Use PlayMaker actions to drive movement

Movement Modes

The agent supports three main target modes:

Pathfinding (Transform / Position)

Used by Pathfinding actions:

  • Move To Target – follow a Transform
  • Move To Position – move to a world-space position

The agent uses A* to build a path of grid cells and moves along them, respecting:

  • Walkability
  • Costs (from Tile Cost Profiles)
  • Clearance (optional)
  • Neighbor mode (4-way or 8-way)

Steering (Turn Decisions)

Used by Steering actions:

  • Steer Towards Position / Target
  • Steer Away From Position / Target

Instead of computing a full path, the agent chooses one step at a time (per cell), reacting to the current situation.

Manual Movement (Per-Cell)

Used by Manual movement actions:

  • Set Direction
  • Get Direction
  • On Arrived
  • Teleport
  • Stop

You (or player input) choose the next direction on the grid.
The agent moves one cell at a time, optionally queuing turns, and staying constrained to walkable cells.

Key Inspector Settings

The NavGrid Asset this agent uses.
It defines the grid, walkable cells, costs, and orientation.

If this is missing or empty, the agent disables itself.

Movement

  • Speed
    Top speed in world units per second.

  • Acceleration Mode
    How the agent accelerates/decelerates (e.g., instant vs smooth).

  • Acceleration / Deceleration
    How fast it speeds up or slows down when using smooth motion.

  • Stopping Distance
    How close the agent must get to the target to consider it "reached"

  • Preserve Speed On Repath
    If enabled, the agent keeps its current speed when a new path is computed (reduces tiny hitches).

Pathfinding Settings (A*)

Used when following a path to a target:

  • Repath Interval
    How often to recompute the path (seconds).

    • > 0 – recompute every N seconds
    • 0 – recompute every frame
    • < 0 – compute once and never update
  • Neighbors
    4-way or 8-way connectivity.

  • No Corner Cut
    For 8-way movement: disallow cutting diagonally across corners.

  • Avoid Reversal
    Don’t choose paths whose first step immediately reverses the current direction.

  • Min Clearance
    Minimum clearance required in the NavGrid (0 = ignore).
    Useful for “fat” agents that can’t go through tight corridors.

  • Cost Weight
    How strongly the agent cares about NavGrid costs:

    • 0 – ignore costs
    • Higher values – avoid expensive cells more aggressively
  • Max Nodes
    Safety limit on how many nodes A* can expand.
    0 means uncapped (use with care).

Manual Movement Settings

Used when Target Mode = Manual or when using manual movement actions:

  • Manual Allowed
    Allowed directions:

    • 4-way (up/down/left/right)
    • 8-way (including diagonals)
  • Turn Window
    How close to the center of a cell the agent must be before it can accept a queued turn.
    Larger values make turning easier/more forgiving.

  • Normalize Diagonal
    When moving diagonally in 8-way mode, optionally normalize speed so diagonals are not faster.

Events (Conceptual)

Internally, the agent exposes events that PlayMaker actions listen to:

  • Arrived – reached the target or finished a manual leg
  • NoPath – could not find a path
  • Aborted – search aborted (e.g., node cap)
  • ReachedEndOfCurrentPath – finished the current path, but not within stopping distance
  • ManualFailed – manual move could not start (blocked/out of bounds)

You normally don’t need to wire these yourself - NavGridAgent actions wrap them into PlayMaker-friendly events.

Debug

  • Draw Path Gizmos
    Shows the current path or manual target in the Scene view:
    • Path lines
    • Current segment marker
    • Manual target marker

Helps debug why the agent chooses a particular route.

Teleport & External Movement

The agent supports teleporting and “external” movement (e.g. tweens):

  • Teleport(worldPosition, keepSpeed)
  • TeleportToCell(cell, snapToCenter, keepSpeed)

If something moves the agent outside of its own control (e.g., you set transform.position in another script), the agent detects that and rebuilds its internal state:

  • For Manual mode: reacquires the current cell & center
  • For Pathfollow: rebuilds the path from the new position

Typical Workflow

  1. Create a NavGrid Asset
    Bake from Tilemaps or build at runtime.

  2. Add a NavGridAgent
    Assign the NavGrid in the inspector.

  3. Configure Movement & Pathfinding
    Adjust Speed, Repath Interval, Neighbors, Stopping Distance, etc.

  4. Use NavGridAgent Actions in FSMs

    • Pathfinding: Move To Target / Move To Position
    • Steering: Steer Towards / Away
    • Manual: Set Direction, On Arrived, Teleport, Stop
    • Settings: Set NavGrid, Set Speed, Set Settings
  5. Play & Debug
    Turn on “Draw Path Gizmos” to see the path and tweak settings.