reckfellENGINE

Crouching: height and route selection

Select a prepared height-specific map and account for the physics body.

On this page

When crouching changes character height, planning must match the chosen state. A low-character route does not authorize traversing it with a standing body without a space check.

Prepare two variants

The size example provides ClearanceBakes.BakeLowCeiling3D(height), creating the same floor and a ceiling at height 1.5 over the middle section. Bake height 2 for standing and height 1 for crouching. Give each output its own map/region, align CellSize/CellHeight, and wait for publication.

The executed fixture cannot reach the far goal on the standing map but can on the crouched map. Querying the standing map again remains blocked; a query on another map does not modify it.

Select a route by state

Save StanceRoutes3D.cs:

C#
using Reckfell;
using System;

public static class StanceRoutes3D
{
    public static Vector3[] Find(Rid standingMap, Rid crouchedMap,
        bool crouched, Vector3 start, Vector3 target)
    {
        Rid map = crouched ? crouchedMap : standingMap;
        if (!map.IsValid || NavigationServer3D.MapGetIterationId(map) == 0)
            return Array.Empty<Vector3>();
        return NavigationServer3D.MapGetPath(map, start, target, true);
    }
}

Pass both live maps, current state and global coordinates. The helper selects a map only for querying. It does not change body height, animation, NavigationAgent map or avoidance. Validate result points: the standing map may return a partial route rather than an empty array.

The check uses start (5, 0.25, 5) and target (25, 0.25, 5). Their vertical coordinate reflects surface rasterization rather than being a universal level height.

Transition between states

  1. Before standing, check actual free space for the new physics shape.
  2. Apply the permitted gameplay state and matching collider/animation.
  3. Select that state's navigation and query again. An old path array does not check the new body size.
  4. With a NavigationAgent, align its map, goal and movement; wait for the server update after switching.
  5. If no complete route exists, keep a permitted state, stop or select another goal according to game rules.

Do not merely assign NavigationMesh.AgentHeight after baking: assignment does not build another mesh. Use a prepared variant or rebake and publish.

Preserve intended mutual avoidance

NavigationAgent2D.SetNavigationMap assigns both the Entity query map and its server agent map. It is not a geometry-only selector. Avoidance is computed within a map; splitting characters across maps can remove their expected mutual awareness.

Do not migrate an agent only for an animation state if you expect shared avoidance with every character. Separate route selection and avoidance architecture explicitly. This helper implements only route selection, not shared avoidance across variants.

Executed checks cover exact map selection and height-1/2 baking beneath the height-1.5 ceiling in 3D; Entity/server map switching was separately checked in 2D. Physics-shape changes, free-space tests, animation and mutual avoidance across variants were not executed.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.