NavigationMesh
A navigation mesh that defines traversable areas and obstacles.
A navigation mesh that defines traversable areas and obstacles.
A navigation mesh is a collection of polygons that define which areas of an environment are traversable to aid agents in pathfinding through complicated spaces.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
NavigationMeshConstructor
public NavigationMesh();Properties26
AgentHeightProperty
public float AgentHeight { get; set; }Free-space height used during 3D baking. Assignment does not change a physics shape or rebake prepared geometry. The same height-1.5 ceiling admits the checked height-1 variant but not height 2; build resolution also affects the output.
AgentMaxClimbProperty
public float AgentMaxClimb { get; set; }The minimum ledge height that is considered to still be traversable.
Note: While baking, this value will be rounded down to the nearest multiple of NavigationMesh.CellHeight.
AgentMaxSlopeProperty
public float AgentMaxSlope { get; set; }The maximum slope that is considered walkable, in degrees.
AgentRadiusProperty
public float AgentRadius { get; set; }Clearance radius used when baking traversable geometry. Changing it does not automatically rebake existing output; inspect boundaries and paths after baking. It is not a physics-shape or avoidance radius.
BorderSizeProperty
public float BorderSize { get; set; }The size of the non-navigable border around the bake bounding area.
In conjunction with the NavigationMesh.FilterBakingAabb and a NavigationMesh.EdgeMaxError value at 1.0 or below the border size can be used to bake tile aligned navigation meshes without the tile edges being shrunk by NavigationMesh.AgentRadius.
Note: If this value is not 0.0, it will be rounded up to the nearest multiple of NavigationMesh.CellSize during baking.
CellHeightProperty
public float CellHeight { get; set; }The cell height used to rasterize the navigation mesh vertices on the Y axis. Must match with the cell height on the navigation map.
CellSizeProperty
public float CellSize { get; set; }The cell size used to rasterize the navigation mesh vertices on the XZ plane. Must match with the cell size on the navigation map.
DetailSampleDistanceProperty
public float DetailSampleDistance { get; set; }The sampling distance to use when generating the detail mesh, in cell unit.
DetailSampleMaxErrorProperty
public float DetailSampleMaxError { get; set; }The maximum distance the detail mesh surface should deviate from heightfield, in cell unit.
EdgeMaxErrorProperty
public float EdgeMaxError { get; set; }The maximum distance a simplified contour's border edges should deviate the original raw contour.
EdgeMaxLengthProperty
public float EdgeMaxLength { get; set; }The maximum allowed length for contour edges along the border of the mesh. A value of 0.0 disables this feature.
Note: While baking, this value will be rounded up to the nearest multiple of NavigationMesh.CellSize.
FilterBakingAabbProperty
public Aabb FilterBakingAabb { get; set; }If the baking Aabb has a volume the navigation mesh baking will be restricted to its enclosing area.
FilterBakingAabbOffsetProperty
public Vector3 FilterBakingAabbOffset { get; set; }The position offset applied to the NavigationMesh.FilterBakingAabb Aabb.
FilterLedgeSpansProperty
public bool FilterLedgeSpans { get; set; }If true, marks spans that are ledges as non-walkable.
FilterLowHangingObstaclesProperty
public bool FilterLowHangingObstacles { get; set; }If true, marks non-walkable spans as walkable if their maximum is within NavigationMesh.AgentMaxClimb of a walkable neighbor.
FilterWalkableLowHeightSpansProperty
public bool FilterWalkableLowHeightSpans { get; set; }If true, marks walkable spans as not walkable if the clearance above the span is less than NavigationMesh.AgentHeight.
GeometryCollisionMaskProperty
public uint GeometryCollisionMask { get; set; }The physics layers to scan for static colliders.
Only used when NavigationMesh.GeometryParsedGeometryType is NavigationMesh.ParsedGeometryType.StaticColliders or NavigationMesh.ParsedGeometryType.Both.
GeometryParsedGeometryTypeProperty
public NavigationMesh.ParsedGeometryType GeometryParsedGeometryType { get; set; }Determines which type of nodes will be parsed as geometry.
GeometrySourceGeometryModeProperty
public NavigationMesh.SourceGeometryMode GeometrySourceGeometryMode { get; set; }The source of the geometry used when baking.
GeometrySourceGroupNameProperty
public StringName GeometrySourceGroupName { get; set; }The name of the group to scan for geometry.
Only used when NavigationMesh.GeometrySourceGeometryMode is NavigationMesh.SourceGeometryMode.GroupsWithChildren or NavigationMesh.SourceGeometryMode.GroupsExplicit.
PolygonsProperty
public Reckfell.Collections.Array Polygons { get; set; }RegionMergeSizeProperty
public float RegionMergeSize { get; set; }Any regions with a size smaller than this will be merged with larger regions if possible. Note: This value will be squared to calculate the number of cells. For example, a value of 20 will set the number of cells to 400.
RegionMinSizeProperty
public float RegionMinSize { get; set; }The minimum size of a region for it to be created. Note: This value will be squared to calculate the minimum number of cells allowed to form isolated island areas. For example, a value of 8 will set the number of cells to 64.
SamplePartitionTypeProperty
public NavigationMesh.SamplePartitionTypeEnum SamplePartitionType { get; set; }Partitioning algorithm for creating the navigation mesh polys.
VerticesProperty
public Vector3[] Vertices { get; set; }VerticesPerPolygonProperty
public float VerticesPerPolygon { get; set; }The maximum number of vertices allowed for polygons generated during the contour to polygon conversion process.
Methods60
AddPolygon2 overloads
public void AddPolygon(int[] polygon);Adds a polygon using the indices of the vertices you get when calling NavigationMesh.GetVertices.
| Name | Type | Default |
|---|---|---|
polygon | int[] | — |
public void AddPolygon(ReadOnlySpan<int> polygon);Adds a polygon using the indices of the vertices you get when calling NavigationMesh.GetVertices.
| Name | Type | Default |
|---|---|---|
polygon | ReadOnlySpan<int> | — |
Clearvoid
public void Clear();Clears the internal arrays for vertices and polygon indices.
ClearPolygonsvoid
public void ClearPolygons();Clears the array of polygons, but it doesn't clear the array of vertices.
CreateFromMeshvoid
public void CreateFromMesh(Mesh mesh);Initializes the navigation mesh by setting the vertices and indices according to a Mesh.
Note: The given mesh must be of type Mesh.PrimitiveType.Triangles and have an index array.
| Name | Type | Default |
|---|---|---|
mesh | Mesh | — |
GetAgentHeightfloat
public float GetAgentHeight();Reads the configured bake height rather than checking the character current physics height.
floatConfigured AgentHeight. It does not itself establish that the resource was already baked with this parameter.
GetAgentMaxClimbfloat
public float GetAgentMaxClimb();floatGetAgentMaxSlopefloat
public float GetAgentMaxSlope();floatGetAgentRadiusfloat
public float GetAgentRadius();floatGetBorderSizefloat
public float GetBorderSize();floatGetCellHeightfloat
public float GetCellHeight();floatGetCellSizefloat
public float GetCellSize();floatGetCollisionMaskuint
public uint GetCollisionMask();uintGetCollisionMaskValuebool
public bool GetCollisionMaskValue(int layerNumber);Returns whether or not the specified layer of the NavigationMesh.GeometryCollisionMask is enabled, given a layer_number between 1 and 32.
| Name | Type | Default |
|---|---|---|
layerNumber | int | — |
boolGetDetailSampleDistancefloat
public float GetDetailSampleDistance();floatGetDetailSampleMaxErrorfloat
public float GetDetailSampleMaxError();floatGetEdgeMaxErrorfloat
public float GetEdgeMaxError();floatGetEdgeMaxLengthfloat
public float GetEdgeMaxLength();floatGetFilterBakingAabbAabb
public Aabb GetFilterBakingAabb();AabbGetFilterBakingAabbOffsetVector3
public Vector3 GetFilterBakingAabbOffset();Vector3GetFilterLedgeSpansbool
public bool GetFilterLedgeSpans();boolGetFilterLowHangingObstaclesbool
public bool GetFilterLowHangingObstacles();boolGetFilterWalkableLowHeightSpansbool
public bool GetFilterWalkableLowHeightSpans();boolGetParsedGeometryTypeNavigationMesh.ParsedGeometryType
public NavigationMesh.ParsedGeometryType GetParsedGeometryType();NavigationMesh.ParsedGeometryTypeGetPolygonint[]
public int[] GetPolygon(int idx);Returns a int[] containing the indices of the vertices of a created polygon.
| Name | Type | Default |
|---|---|---|
idx | int | — |
int[]GetPolygonCountint
public int GetPolygonCount();Returns the navigation resource polygon count. A positive count establishes data presence, rather than map readiness, target reachability or physical character clearance.
intPolygon count; zero means this resource has no prepared polygons.
GetRegionMergeSizefloat
public float GetRegionMergeSize();floatGetRegionMinSizefloat
public float GetRegionMinSize();floatGetSamplePartitionTypeNavigationMesh.SamplePartitionTypeEnum
public NavigationMesh.SamplePartitionTypeEnum GetSamplePartitionType();NavigationMesh.SamplePartitionTypeEnumGetSourceGeometryModeNavigationMesh.SourceGeometryMode
public NavigationMesh.SourceGeometryMode GetSourceGeometryMode();NavigationMesh.SourceGeometryModeGetSourceGroupNameStringName
public StringName GetSourceGroupName();StringNameGetVerticesVector3[]
public Vector3[] GetVertices();Returns a Vector3[] containing all the vertices being used to create the polygons.
Vector3[]GetVerticesPerPolygonfloat
public float GetVerticesPerPolygon();floatSetAgentHeightvoid
public void SetAgentHeight(float agentHeight);Free-space height used during 3D baking. Assignment does not change a physics shape or rebake prepared geometry. The same height-1.5 ceiling admits the checked height-1 variant but not height 2; build resolution also affects the output.
| Name | Type | Default |
|---|---|---|
agentHeight | float | — |
agentHeightNonnegative height in source-geometry units. Bake again after changing it.
SetAgentMaxClimbvoid
public void SetAgentMaxClimb(float agentMaxClimb);| Name | Type | Default |
|---|---|---|
agentMaxClimb | float | — |
SetAgentMaxSlopevoid
public void SetAgentMaxSlope(float agentMaxSlope);| Name | Type | Default |
|---|---|---|
agentMaxSlope | float | — |
SetAgentRadiusvoid
public void SetAgentRadius(float agentRadius);| Name | Type | Default |
|---|---|---|
agentRadius | float | — |
SetBorderSizevoid
public void SetBorderSize(float borderSize);| Name | Type | Default |
|---|---|---|
borderSize | float | — |
SetCellHeightvoid
public void SetCellHeight(float cellHeight);| Name | Type | Default |
|---|---|---|
cellHeight | float | — |
SetCellSizevoid
public void SetCellSize(float cellSize);| Name | Type | Default |
|---|---|---|
cellSize | float | — |
SetCollisionMaskvoid
public void SetCollisionMask(uint mask);| Name | Type | Default |
|---|---|---|
mask | uint | — |
SetCollisionMaskValuevoid
public void SetCollisionMaskValue(int layerNumber, bool value);Based on value, enables or disables the specified layer in the NavigationMesh.GeometryCollisionMask, given a layer_number between 1 and 32.
| Name | Type | Default |
|---|---|---|
layerNumber | int | — |
value | bool | — |
SetDetailSampleDistancevoid
public void SetDetailSampleDistance(float detailSampleDist);| Name | Type | Default |
|---|---|---|
detailSampleDist | float | — |
SetDetailSampleMaxErrorvoid
public void SetDetailSampleMaxError(float detailSampleMaxError);| Name | Type | Default |
|---|---|---|
detailSampleMaxError | float | — |
SetEdgeMaxErrorvoid
public void SetEdgeMaxError(float edgeMaxError);| Name | Type | Default |
|---|---|---|
edgeMaxError | float | — |
SetEdgeMaxLengthvoid
public void SetEdgeMaxLength(float edgeMaxLength);| Name | Type | Default |
|---|---|---|
edgeMaxLength | float | — |
SetFilterBakingAabbvoid
public void SetFilterBakingAabb(Aabb bakingAabb);| Name | Type | Default |
|---|---|---|
bakingAabb | Aabb | — |
SetFilterBakingAabbOffsetvoid
public void SetFilterBakingAabbOffset(Vector3 bakingAabbOffset);| Name | Type | Default |
|---|---|---|
bakingAabbOffset | Vector3 | — |
SetFilterLedgeSpansvoid
public void SetFilterLedgeSpans(bool filterLedgeSpans);| Name | Type | Default |
|---|---|---|
filterLedgeSpans | bool | — |
SetFilterLowHangingObstaclesvoid
public void SetFilterLowHangingObstacles(bool filterLowHangingObstacles);| Name | Type | Default |
|---|---|---|
filterLowHangingObstacles | bool | — |
SetFilterWalkableLowHeightSpansvoid
public void SetFilterWalkableLowHeightSpans(bool filterWalkableLowHeightSpans);| Name | Type | Default |
|---|---|---|
filterWalkableLowHeightSpans | bool | — |
SetParsedGeometryTypevoid
public void SetParsedGeometryType(NavigationMesh.ParsedGeometryType geometryType);| Name | Type | Default |
|---|---|---|
geometryType | NavigationMesh.ParsedGeometryType | — |
SetRegionMergeSizevoid
public void SetRegionMergeSize(float regionMergeSize);| Name | Type | Default |
|---|---|---|
regionMergeSize | float | — |
SetRegionMinSizevoid
public void SetRegionMinSize(float regionMinSize);| Name | Type | Default |
|---|---|---|
regionMinSize | float | — |
SetSamplePartitionTypevoid
public void SetSamplePartitionType(NavigationMesh.SamplePartitionTypeEnum samplePartitionType);| Name | Type | Default |
|---|---|---|
samplePartitionType | NavigationMesh.SamplePartitionTypeEnum | — |
SetSourceGeometryModevoid
public void SetSourceGeometryMode(NavigationMesh.SourceGeometryMode mask);| Name | Type | Default |
|---|---|---|
mask | NavigationMesh.SourceGeometryMode | — |
SetSourceGroupNamevoid
public void SetSourceGroupName(StringName mask);| Name | Type | Default |
|---|---|---|
mask | StringName | — |
SetVertices2 overloads
public void SetVertices(Vector3[] vertices);Sets the vertices that can be then indexed to create polygons with the NavigationMesh.AddPolygon method.
| Name | Type | Default |
|---|---|---|
vertices | Vector3[] | — |
public void SetVertices(ReadOnlySpan<Vector3> vertices);Sets the vertices that can be then indexed to create polygons with the NavigationMesh.AddPolygon method.
| Name | Type | Default |
|---|---|---|
vertices | ReadOnlySpan<Vector3> | — |
SetVerticesPerPolygonvoid
public void SetVerticesPerPolygon(float verticesPerPolygon);| Name | Type | Default |
|---|---|---|
verticesPerPolygon | float | — |
NavigationMesh.ParsedGeometryType
| Value | Description |
|---|---|
Both = 2 | Both |
Max = 3 | Represents the size of the |
MeshInstances = 0 | Parses mesh instances as geometry. This includes |
StaticColliders = 1 | Parses |
NavigationMesh.SamplePartitionTypeEnum
| Value | Description |
|---|---|
Layers = 2 | Layer partitioning. Good choice to use for tiled navigation mesh with medium and small sized tiles. |
Max = 3 | Represents the size of the |
Monotone = 1 | Monotone partitioning. Use this if you want fast navigation mesh generation. |
Watershed = 0 | Watershed partitioning. Generally the best choice if you precompute the navigation mesh, use this if you have large open areas. |
NavigationMesh.SourceGeometryMode
| Value | Description |
|---|---|
GroupsExplicit = 2 | Uses nodes in a group for geometry. The group is specified by |
GroupsWithChildren = 1 | Scans nodes in a group and their child nodes recursively for geometry. The group is specified by |
Max = 3 | Represents the size of the |
RootNodeChildren = 0 | Scans the child nodes of the root node recursively for geometry. |