Navigation
Updated
Navigation decides where people and characters can go. Some of it moves the player: where they arrive when they join, the spots they can click to stand on, and the portals that carry them from one area to another. The rest lets non-player characters move on their own: a guard walking its rounds, villagers going about their day, a pet following the player, a flock of birds. MIRA gives you two complementary tools. Pathfinding answers “how do I get there?”: a baked navigation mesh and NavMesh Agents that find a path round walls and through doors. Steering answers “how should I move right now?”: small behaviours such as seek, flee, wander and flock that combine into lifelike motion.
Key concepts
Section titled “Key concepts”- Spawn point: Where a player enters a scene. When several exist, their priority and slots decide which one is used.
- Spot and travel points: A spot point is a click-to-go destination; a travel point is a portal, paired with another by channel.
- Navmesh. A navigation mesh: a simplified map of every place a character can stand, baked from the floors you mark as walkable and carved around the obstacles you mark as collidable.
- Bake. Computing the navmesh from the scene. Bake in the editor, or from a script after building a level; changes to walkable ground, obstacles or links need a new bake.
- NavMesh Agent. A character that plans a path across the navmesh to a destination and follows it, avoiding the other agents as a crowd.
- NavMesh Link. A shortcut the navmesh does not otherwise have: a jump across a gap, a drop off a ledge, a ladder.
- Steering behaviour. A component that pushes a character in one direction with a weight: seek, flee, arrive, wander, follow a path, flock, queue, avoid. A Steering Agent adds the pushes up every frame and moves the character.
- Character Controller. The body that walks. Agents usually drive a Character Controller, so the character keeps its walking speed, steps and animation.
How it works
Section titled “How it works”Placing the player
Section titled “Placing the player”Spawn points, spot points, travel points and teleports all follow one rule: if the camera follows a character, the character is placed on the point and the camera comes along; otherwise the camera stands on the point at eye height. The runtime then sends Camera::relocate. In an immersive VR or AR session, placement points move the XR rig (or the Character Controller carrying it).
They act only in play, and each player’s device moves only its own player; nothing is sent over the network. Each point faces where its transform points, its forward (-Z), and that is the way the player looks on arrival. Their events (SpawnPoint::place, SpotPoint::occupied, TravelPoint::arrive and the others) reach scripts through a Signal Emitter on the point itself.
Characters that find their own way
Section titled “Characters that find their own way”- Mark the world. A NavMesh Surface entity owns the navmesh. NavMesh Walkable goes on floors, ramps and platforms; NavMesh Collidable goes on walls, crates and furniture.
- Bake. The surface computes the navmesh. Select it in the editor to see the walkable area drawn over the scene.
- Move agents. A script calls
moveToon a NavMesh Agent; the agent plans a path and walks it, crossing links on the way, and reports when it arrives. - Or steer. For motion that reacts moment to moment, such as fleeing, chasing or flocking, add steering behaviours and a Steering Agent, and let a script switch behaviours on and off.
Pathfinding and steering work together: steering can follow a path an agent planned, and both drive the same Character Controller. The navmesh is computed from the surfaces marked NavMesh Walkable, carved around those marked NavMesh Collidable, together with every NavMesh Link: bake again whenever the level’s geometry or its links change.
Your first walking character
Section titled “Your first walking character”This walkthrough makes a character walk to wherever the player clicks on the floor.
-
Add a NavMesh Surface entity to the scene.
-
Add NavMesh Walkable to the floor and NavMesh Collidable to any walls or crates. Select the surface and bake.
-
Add a character: a model or a capsule, with a Character Controller (
controls: false, so the player’s keys do not move it) and a NavMesh Agent. Name itWalker. -
Add a Behavior entity with this script:
ClickToWalk.jx #pragma lifecycle(startup, update)let agent;function startup() {agent = findEntity('Walker').getComponent(NavMeshAgentComponent);}function update() {if (!Input.mouse.isButtonReleased(MouseButton.Left)) return;// Find the point of the floor under the pointer.const hit = GraphicsRaycaster.fromScreen(Input.mouse.position()).hit();if (hit) agent.moveTo(hit.point);} -
Enter play and click the floor: the character walks there, round any obstacle.
Your first walking character: a NavMesh Agent walks to the point of the floor under a click, round the walls, found with GraphicsRaycaster.
Click anywhere on the floor: the capsule walks there, round the walls.
Choosing
Section titled “Choosing”| If you want… | Use… | Read |
|---|---|---|
| Players to arrive at a chosen place, facing a chosen way, when they join | Spawn Point | Spawn points |
| A destination players click (or a script sends them to) and stand on | Spot Point | Spot and travel points |
| A portal that sends whoever walks into it to another place | Travel Point | Spot and travel points |
| To mark where characters can walk, and bake it, so they find paths around walls and avoid each other | NavMesh Surface, Walkable, Collidable | Spawn points |
| Spot and travel points | Click-to-go destinations with reservation, and in/out portals paired by channel. | |
| Navigation meshes | ||
| Characters that jump a gap, drop from a ledge or climb a ladder between areas | NavMesh Link | NavMesh Links |
| Characters that find a path to a destination | NavMesh Agent | NavMesh Agents |
| Crowds, flocks, chasers and patrols | Steering Agent and behaviours | Steering |
| The player’s own walking | Character Controller | Character Controller |
Entity types
Section titled “Entity types”Each navigation entity type has a page of its components, props, events and a first script:
| Entity | Type | What it is |
|---|---|---|
| Navmesh Link | ent-navmesh-link | A shortcut between two points: a jump, ladder or teleport. |
| Navmesh Surface | ent-navmesh-surface | The scene's walkable navmesh that agents find paths on. |
| Spawn Point | ent-spawn-point | Marks where the player enters the scene. With several, one is picked by priority each time the player joins. |
| Spot Point | ent-spot-point | Marks a spot in the world that gameplay systems can find and send the player to. |
| Travel Point | ent-travel-point | Walking into an in portal sends the player to an out portal of the same channel. |
In scripts
Section titled “In scripts”| Global | What it is |
|---|---|
SpawnPointComponent | Marks where the view enters a scene. On activation it joins the global spawnPointService; when the player joins (a scene load in play mode), the service weighted-randomly picks ONE active spawn to place the camera — so multiple spawn points distribute the entry rather than fighting over it. One activated later only joins the pool. It moves the main camera (its entity; a cut to another camera never takes it), else the active placed camera, else the default canvas camera — in VR, the XR camera rig — to the pose resolvePlacement computes from the spawn's transform and props. When the camera's controller follows a target (a character), the target is placed there and the camera moves alongside. Then Camera::relocate hands the camera to its controller (CameraComponent.relocate). |
SpotPointComponent | A travel destination, independent of spawn selection. Moves the main (else active or default) camera in Play. |
TravelPointComponent | A portal. Walking into an in portal sends the player to an out portal of the same channel; with several, they take arrivals in turn. The player lands facing the out portal's forward, the way its arrow points, and must step out of an in portal before it sends them again. Each client sends its own player: nothing goes over the network. Play only. |
NavMeshSurfaceComponent | The walkable surface for a scene — a scene singleton that owns the Recast NavMesh, its NavMeshQuery, and the Crowd every NavMeshAgentComponent steers within. When NavMeshSurfaceProps.data is present the surface loads that baked binary (instant, off-mesh links already inside it); otherwise it bakes from the scene's NavMeshWalkableComponent geometry plus every NavMeshLinkComponent under it, a slice per frame so a large scene never freezes it. The navigation bridge builds the surface and registers agents; this component then steps the crowd each frame in onUpdate and lets each agent mirror its result. |
NavMeshAgentComponent | Moves an entity over a navmesh: walk a step each frame, moveTo a point (pathfinding at speed) and stop, teleport; destination, isMoving, isGrounded; NavMeshAgent::arrive when a moveTo gets there. It never turns the entity: a CharacterControllerComponent on the entity walks it, turns it and reports its state, and a SteeringAgentComponent gives that character AI behaviors. |
NavMeshLinkComponent | An off-mesh connection baked into a NavMeshSurfaceComponent: a manual shortcut (jump, drop, ladder, teleport) linking two points the walkable surface does not otherwise join. Its host entity's world position is the start; rotating the entity moves the whole link. One-way links (bidirectional: false) are traversed start → end only. The surface reads every link under it at bake time via toConnection. |
SteeringAgentComponent | The AI brain of a character: each frame the app's SteeringWorld sums the steering of its enabled behaviors (seek, flock, avoid… each a Steering…Component on the same entity, scaled by its weight) — the velocity change they want, applied over a quarter second — limits it to maxForce, divides by mass and integrates its velocity without exceeding the requested change in a frame. The resulting velocity is capped at its effective speed. A CharacterControllerComponent owns character movement when attached. Standalone agents move on a NavMesh Agent or write their own ground-plane transform. Stopped, the agent faces its behavior's target (seek, arrive, pursue, follow leader); near it, it keeps facing it while it steps aside, backs off or settles. With no behavior pushing it brakes to a stop. |
Components
Section titled “Components”| Component | Type | What it does |
|---|---|---|
| Navmesh Agent | comp-navmesh-agent | Moves the entity along navmesh paths. |
| Navmesh Collidable | comp-navmesh-collidable | Marks this entity as an obstacle the navmesh is baked around. Padding keeps agents that much further from it. |
| Navmesh Link | comp-navmesh-link | A shortcut between two points: a jump, ladder or teleport. |
| Navmesh Surface | comp-navmesh-surface | The scene's walkable navmesh that agents find paths on. |
| Navmesh Walkable | comp-navmesh-walkable | Marks this entity's surfaces as ground agents walk on when the navmesh is baked. Too steep stays unwalkable. |
| Spawn Point | comp-spawn-point | Marks where the player enters the scene. With several, one is picked by priority each time the player joins. |
| Spot Point | comp-spot-point | Marks a spot in the world that gameplay systems can find and send the player to. |
| Steering Agent | comp-steering-agent | The AI brain of a character: it sums the steering behaviors on its entity. |
| Steering Arrive | comp-steering-arrive | Go to a target and slow down to stop on it. |
| Steering Avoid | comp-steering-avoid | Steer around obstacles. |
| Steering Collidable | comp-steering-collidable | An obstacle that steering agents keep clear of. |
| Steering Evade | comp-steering-evade | Flee from where the target is going to be. |
| Steering Flee | comp-steering-flee | Run away from a target when it gets close. |
| Steering Flock | comp-steering-flock | Boids: stay together, align and keep apart from neighbors. |
| Steering Follow Leader | comp-steering-follow-leader | Follow a leader and step out of its way. |
| Steering Follow Path | comp-steering-follow-path | Follow a list of points in order. |
| Steering Interpose | comp-steering-interpose | Get between two targets, like a bodyguard. |
| Steering Pursue | comp-steering-pursue | Chase where the target is going to be. |
| Steering Queue | comp-steering-queue | Brake behind other agents so crowds line up. |
| Steering Seek | comp-steering-seek | Go toward a target. |
| Steering Wander | comp-steering-wander | Smooth random roaming. |
| Travel Point | comp-travel-point | Walking into an in portal sends the player to an out portal of the same channel. |
In this section
Section titled “In this section”| Topic | Description |
|---|---|
| Navigation meshes | The NavMesh Surface, walkable ground and obstacles, bake settings and baking from a script. |
| NavMesh Links | Jumps, drops and ladders that join areas the navmesh does not connect. |
| NavMesh Agents | Characters that find paths, move as a crowd and report when they arrive. |
| Steering | Compose AI movement from seek, flee, arrive, wander, flock, follow-path and other behaviours. |