rcBuildRegions

Builds region data for the heightfield using watershed partitioning.

Windows
MacOS
Linux

Warnings

  • The distance field must be created using rcBuildDistanceField before attempting to build regions.

References

Module

Navmesh

Header

/Engine/Source/Runtime/Navmesh/Public/Recast/Recast.h

Include

#include "Recast/Recast.h"

Source

/Engine/Source/Runtime/Navmesh/Private/Recast/RecastRegion.cpp

Syntax

bool rcBuildRegions
(
    rcContext * ctx,
    rcCompactHeightfield & chf,
    const int borderSize,
    const int minRegionArea,
    const int mergeRegionArea
)

Remarks

Builds region data for the heightfield using watershed partitioning.

Non-null regions will consist of connected, non-overlapping walkable spans that form a single contour. Contours will form simple polygons.

If multiple regions form an area that is smaller than `minRegionArea_, then all spans will be re-assigned to the zero (null) region.

Watershed partitioning can result in smaller than necessary regions, especially in diagonal corridors. `mergeRegionArea_ helps reduce unecessarily small regions.

See the rcConfig documentation for more information on the configuration parameters.

The region data will be available via the [rcCompactHeightfield::maxRegions](API\Runtime\Navmesh\Recast\rcCompactHeightfield\maxRegions) and [rcCompactSpan::reg](API\Runtime\Navmesh\Recast\rcCompactSpan\reg) fields.

The distance field must be created using rcBuildDistanceField before attempting to build regions.

Returns

True if the operation completed successfully.

Parameters

Parameter

Description

ctx

The build context to use during the operation.

chf

A populated compact heightfield.

borderSize

The size of the non-navigable border around the heightfield. [Limit: >=0] [Units: vx]

minRegionArea

The minimum number of cells allowed to form isolated island areas. [Limit: >=0] [Units: vx].

mergeRegionArea

Any regions with a span count smaller than this value will, if possible, be merged with larger regions. [Limit: >=0] [Units: vx]

See Also

rcCompactHeightfield

rcCompactSpan

rcBuildDistanceField

rcBuildRegionsMonotone

rcConfig

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss