navcat docs
    Preparing search index...

    Function erodeAndMarkWalkableAreas

    • Erodes the walkable area for a base agent radius and marks restricted areas for larger agents based on given walkable radius thresholds.

      Note that this function requires careful tuning of the build parameters to get a good result:

      • The cellSize needs to be small enough to accurately represent narrow passages. Generally you need to use smaller cellSizes than you otherwise would for single agent navmesh builds.
      • The thresholds should not be so small that the resulting regions are too small to successfully build good navmesh polygons for. Values like 1-2 voxels will likely lead to poor results.
      • You may get a better result using "buildRegionsMonotone" over "buildRegions" as this will better handle the many small clusters of areas that may be created from smaller thresholds.

      A typical workflow for using this utility to implement multi-agent support:

      1. Call erodeAndMarkWalkableAreas with your smallest agent radius and list of restricted areas
      2. Continue with buildDistanceField, buildRegionsMonotone, etc.
      3. Configure query filters so large agents exclude the narrow/restricted area IDs

      Parameters

      • baseWalkableRadiusVoxels: number

        the smallest agent radius in voxels (used for erosion)

      • thresholds: { areaId: number; walkableRadiusVoxels: number }[]

        array of area ids and their corresponding walkable radius in voxels.

      • compactHeightfield: CompactHeightfield

        the compact heightfield to process

      Returns void