Dungeon Architect  17.0.0
SharpNav.CompactHeightfield Class Reference

A more memory-compact heightfield that stores open spans of voxels instead of closed ones. More...

Public Member Functions

 CompactHeightfield (Heightfield field, NavMeshGenerationSettings settings)
 Initializes a new instance of the CompactHeightfield class. More...
 
 CompactHeightfield (Heightfield field, int walkableHeight, int walkableClimb)
 Initializes a new instance of the CompactHeightfield class. More...
 
void BuildDistanceField ()
 Builds a distance field, or the distance to the nearest unwalkable area. More...
 
void Erode (int radius)
 Erodes the walkable areas in the map. More...
 
void BuildRegions (int borderSize, int minRegionArea, int mergeRegionArea)
 The central method for building regions, which consists of connected, non-overlapping walkable spans. More...
 
ContourSet BuildContourSet (NavMeshGenerationSettings settings)
 Builds a set of Contours around the generated regions. Must be called after regions are generated. More...
 
ContourSet BuildContourSet (float maxError, int maxEdgeLength, ContourBuildFlags buildFlags)
 Builds a set of Contours around the generated regions. Must be called after regions are generated. More...
 

Properties

int Width [get]
 Gets the width of the CompactHeightfield in voxel units. More...
 
int Height [get]
 Gets the height of the CompactHeightfield in voxel units. More...
 
int Length [get]
 Gets the length of the CompactHeightfield in voxel units. More...
 
BBox3 Bounds [get]
 Gets the world-space bounding box. More...
 
float CellSize [get]
 Gets the world-space size of a cell in the XZ plane. More...
 
float CellHeight [get]
 Gets the world-space size of a cell in the Y direction. More...
 
int MaxDistance [get]
 Gets the maximum distance to a border based on the distance field. This value is undefined prior to calling BuildDistanceField. More...
 
int[] Distances [get]
 Gets an array of distances from a span to the nearest border. This value is undefined prior to calling BuildDistanceField. More...
 
int BorderSize [get]
 Gets the size of the border. More...
 
int MaxRegions [get]
 Gets the maximum number of allowed regions. More...
 
CompactCell[] Cells [get]
 Gets the cells. More...
 
CompactSpan[] Spans [get]
 Gets the spans. More...
 
Area[] Areas [get]
 Gets the area flags. More...
 
IEnumerable< CompactSpanthis[int x, int y] [get]
 Gets an IEnumerable<T> of CompactSpan of the spans at a specified coordiante. More...
 
IEnumerable< CompactSpanthis[int i] [get]
 Gets an IEnumerable<T> of CompactSpans at a specified index. More...
 
CompactSpan this[CompactSpanReference spanRef] [get]
 Gets the CompactSpan specified by the reference. More...
 

Detailed Description

A more memory-compact heightfield that stores open spans of voxels instead of closed ones.

Definition at line 14 of file CompactHeightfield.cs.

Constructor & Destructor Documentation

◆ CompactHeightfield() [1/2]

SharpNav.CompactHeightfield.CompactHeightfield ( Heightfield  field,
NavMeshGenerationSettings  settings 
)

Initializes a new instance of the CompactHeightfield class.

Parameters
fieldA Heightfield to build from.
settingsThe settings to build with.

Definition at line 38 of file CompactHeightfield.cs.

◆ CompactHeightfield() [2/2]

SharpNav.CompactHeightfield.CompactHeightfield ( Heightfield  field,
int  walkableHeight,
int  walkableClimb 
)

Initializes a new instance of the CompactHeightfield class.

Parameters
fieldA Heightfield to build from.
walkableHeightThe maximum difference in height to filter.
walkableClimbThe maximum difference in slope to filter.

Definition at line 49 of file CompactHeightfield.cs.

Member Function Documentation

◆ BuildContourSet() [1/2]

ContourSet SharpNav.CompactHeightfield.BuildContourSet ( float  maxError,
int  maxEdgeLength,
ContourBuildFlags  buildFlags 
)

Builds a set of Contours around the generated regions. Must be called after regions are generated.

Parameters
maxErrorThe maximum allowed deviation in a simplified contour from a raw one.
maxEdgeLengthThe maximum edge length.
buildFlagsFlags that change settings for the build process.
Returns
A ContourSet containing one contour per region.

Definition at line 1390 of file CompactHeightfield.cs.

◆ BuildContourSet() [2/2]

ContourSet SharpNav.CompactHeightfield.BuildContourSet ( NavMeshGenerationSettings  settings)

Builds a set of Contours around the generated regions. Must be called after regions are generated.

Parameters
settingsSettings for building the ContourSet.
Returns
A ContourSet containing one contour per region.

Definition at line 1378 of file CompactHeightfield.cs.

◆ BuildDistanceField()

void SharpNav.CompactHeightfield.BuildDistanceField ( )

Builds a distance field, or the distance to the nearest unwalkable area.

Definition at line 341 of file CompactHeightfield.cs.

◆ BuildRegions()

void SharpNav.CompactHeightfield.BuildRegions ( int  borderSize,
int  minRegionArea,
int  mergeRegionArea 
)

The central method for building regions, which consists of connected, non-overlapping walkable spans.

Parameters
borderSizeThe border size
minRegionAreaIf smaller than this value, region will be null
mergeRegionAreaReduce unneccesarily small regions

Definition at line 390 of file CompactHeightfield.cs.

◆ Erode()

void SharpNav.CompactHeightfield.Erode ( int  radius)

Erodes the walkable areas in the map.

If you have already called BuildDistanceField, it will automatically be called again after erosion because it needs to be recalculated.

Parameters
radiusThe radius to erode from unwalkable areas.

Definition at line 366 of file CompactHeightfield.cs.

Property Documentation

◆ Areas

Area [] SharpNav.CompactHeightfield.Areas
get

Gets the area flags.

Definition at line 279 of file CompactHeightfield.cs.

◆ BorderSize

int SharpNav.CompactHeightfield.BorderSize
get

Gets the size of the border.

Definition at line 235 of file CompactHeightfield.cs.

◆ Bounds

BBox3 SharpNav.CompactHeightfield.Bounds
get

Gets the world-space bounding box.

Definition at line 178 of file CompactHeightfield.cs.

◆ CellHeight

float SharpNav.CompactHeightfield.CellHeight
get

Gets the world-space size of a cell in the Y direction.

Definition at line 200 of file CompactHeightfield.cs.

◆ Cells

CompactCell [] SharpNav.CompactHeightfield.Cells
get

Gets the cells.

Definition at line 257 of file CompactHeightfield.cs.

◆ CellSize

float SharpNav.CompactHeightfield.CellSize
get

Gets the world-space size of a cell in the XZ plane.

Definition at line 189 of file CompactHeightfield.cs.

◆ Distances

int [] SharpNav.CompactHeightfield.Distances
get

Gets an array of distances from a span to the nearest border. This value is undefined prior to calling BuildDistanceField.

Definition at line 224 of file CompactHeightfield.cs.

◆ Height

int SharpNav.CompactHeightfield.Height
get

Gets the height of the CompactHeightfield in voxel units.

Definition at line 156 of file CompactHeightfield.cs.

◆ Length

int SharpNav.CompactHeightfield.Length
get

Gets the length of the CompactHeightfield in voxel units.

Definition at line 167 of file CompactHeightfield.cs.

◆ MaxDistance

int SharpNav.CompactHeightfield.MaxDistance
get

Gets the maximum distance to a border based on the distance field. This value is undefined prior to calling BuildDistanceField.

Definition at line 212 of file CompactHeightfield.cs.

◆ MaxRegions

int SharpNav.CompactHeightfield.MaxRegions
get

Gets the maximum number of allowed regions.

Definition at line 246 of file CompactHeightfield.cs.

◆ Spans

CompactSpan [] SharpNav.CompactHeightfield.Spans
get

Gets the spans.

Definition at line 268 of file CompactHeightfield.cs.

◆ this[CompactSpanReference spanRef]

CompactSpan SharpNav.CompactHeightfield.this[CompactSpanReference spanRef]
get

Gets the CompactSpan specified by the reference.

Parameters
spanRefA reference to a span in this CompactHeightfield.
Returns
The referenced span.

Definition at line 330 of file CompactHeightfield.cs.

◆ this[int i]

IEnumerable<CompactSpan> SharpNav.CompactHeightfield.this[int i]
get

Gets an IEnumerable<T> of CompactSpans at a specified index.

Parameters
iThe index.
Returns
An IEnumerable<T> of CompactSpan.

Definition at line 313 of file CompactHeightfield.cs.

◆ this[int x, int y]

IEnumerable<CompactSpan> SharpNav.CompactHeightfield.this[int x, int y]
get

Gets an IEnumerable<T> of CompactSpan of the spans at a specified coordiante.

Parameters
xThe X coordinate.
yThe Y coordinate.
Returns
An IEnumerable<T> of CompactSpan.

Definition at line 293 of file CompactHeightfield.cs.

◆ Width

int SharpNav.CompactHeightfield.Width
get

Gets the width of the CompactHeightfield in voxel units.

Definition at line 145 of file CompactHeightfield.cs.


The documentation for this class was generated from the following file: