reckfellENGINE

NavigationRegion2D

A traversable 2D region that NavigationAgent2Ds can use for pathfinding.

On this page
class NavigationRegion2DReckfellSharpInherits Entity2D

A traversable 2D region that NavigationAgent2Ds can use for pathfinding.

A traversable 2D region based on a NavigationPolygon that NavigationAgent2Ds can use for pathfinding. Two regions can be connected to each other if they share a similar edge. You can set the minimum distance between two vertices required to connect two edges by using NavigationServer2D.MapSetEdgeConnectionMargin. Note: Overlapping two regions' navigation polygons is not enough for connecting two regions. They must share a similar edge. The pathfinding cost of entering a region from another region can be controlled with the NavigationRegion2D.EnterCost value. Note: This value is not added to the path cost when the start position is already inside this region. The pathfinding cost of traveling distances inside this region can be controlled with the NavigationRegion2D.TravelCost multiplier. Note: This node caches changes to its properties, so if you make changes to the underlying region Rid in NavigationServer2D, they will not be reflected in this node's properties.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

NavigationRegion2DConstructor
# NavigationRegion2D
C#
public NavigationRegion2D();

Properties6

EnabledProperty
# Enabled
C#
public bool Enabled { get; set; }

Determines if the NavigationRegion2D is enabled or disabled.

EnterCostProperty
# EnterCost
C#
public float EnterCost { get; set; }

When pathfinding enters this region's navigation mesh from another region's navigation mesh, this property's value is added to the path distance used to determine the shortest path.

NavigationLayersProperty
# NavigationLayers
C#
public uint NavigationLayers { get; set; }

A bitfield determining all navigation layers the region belongs to. These navigation layers can be checked upon when requesting a path with NavigationServer2D.MapGetPath.

NavigationPolygonProperty
# NavigationPolygon
C#
public NavigationPolygon NavigationPolygon { get; set; }

The NavigationPolygon resource to use.

TravelCostProperty
# TravelCost
C#
public float TravelCost { get; set; }

When pathfinding moves inside this region's navigation mesh the traveled distances are multiplied with NavigationRegion2D.TravelCost for determining the shortest path.

UseEdgeConnectionsProperty
# UseEdgeConnections
C#
public bool UseEdgeConnections { get; set; }

If enabled the navigation region will use edge connections to connect with other navigation regions within proximity of the navigation map edge connection margin.

Methods21

BakeNavigationPolygonvoid
# BakeNavigationPolygon
C#
public void BakeNavigationPolygon(bool onThread = true);

Bakes the NavigationPolygon. If on_thread is set to true (default), the baking is done on a separate thread.

Parameters
NameTypeDefault
onThreadbooltrue
GetBoundsRect2
# GetBounds
C#
public Rect2 GetBounds();

Returns the axis-aligned rectangle for the region's transformed navigation mesh.

Returns Rect2
GetEnterCostfloat
# GetEnterCost
C#
public float GetEnterCost();
Returns float
GetNavigationLayerValuebool
# GetNavigationLayerValue
C#
public bool GetNavigationLayerValue(int layerNumber);

Returns whether or not the specified layer of the NavigationRegion2D.NavigationLayers bitmask is enabled, given a layer_number between 1 and 32.

Parameters
NameTypeDefault
layerNumberint—
Returns bool
GetNavigationLayersuint
# GetNavigationLayers
C#
public uint GetNavigationLayers();
Returns uint
GetNavigationMapRid
# GetNavigationMap
C#
public Rid GetNavigationMap();

Returns the current navigation map Rid used by this region.

Returns Rid
GetNavigationPolygonNavigationPolygon
# GetNavigationPolygon
C#
public NavigationPolygon GetNavigationPolygon();
Returns NavigationPolygon
GetRegionRidRid · Deprecated
# GetRegionRid
C#
public Rid GetRegionRid();

Returns the Rid of this region on the NavigationServer2D.

Returns Rid
GetRidRid
# GetRid
C#
public Rid GetRid();

Returns the Rid of this region on the NavigationServer2D. Combined with NavigationServer2D.MapGetClosestPointOwner can be used to identify the NavigationRegion2D closest to a point on the merged navigation map.

Returns Rid
GetTravelCostfloat
# GetTravelCost
C#
public float GetTravelCost();
Returns float
GetUseEdgeConnectionsbool
# GetUseEdgeConnections
C#
public bool GetUseEdgeConnections();
Returns bool
IsBakingbool
# IsBaking
C#
public bool IsBaking();

Returns true when the NavigationPolygon is being baked on a background thread.

Returns bool
IsEnabledbool
# IsEnabled
C#
public bool IsEnabled();
Returns bool
SetEnabledvoid
# SetEnabled
C#
public void SetEnabled(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetEnterCostvoid
# SetEnterCost
C#
public void SetEnterCost(float enterCost);
Parameters
NameTypeDefault
enterCostfloat—
SetNavigationLayerValuevoid
# SetNavigationLayerValue
C#
public void SetNavigationLayerValue(int layerNumber, bool value);

Based on value, enables or disables the specified layer in the NavigationRegion2D.NavigationLayers bitmask, given a layer_number between 1 and 32.

Parameters
NameTypeDefault
layerNumberint—
valuebool—
SetNavigationLayersvoid
# SetNavigationLayers
C#
public void SetNavigationLayers(uint navigationLayers);
Parameters
NameTypeDefault
navigationLayersuint—
SetNavigationMapvoid
# SetNavigationMap
C#
public void SetNavigationMap(Rid navigationMap);

Sets the Rid of the navigation map this region should use. By default the region will automatically join the World2D default navigation map so this function is only required to override the default map.

Parameters
NameTypeDefault
navigationMapRid—
SetNavigationPolygonvoid
# SetNavigationPolygon
C#
public void SetNavigationPolygon(NavigationPolygon navigationPolygon);
Parameters
NameTypeDefault
navigationPolygonNavigationPolygon—
SetTravelCostvoid
# SetTravelCost
C#
public void SetTravelCost(float travelCost);
Parameters
NameTypeDefault
travelCostfloat—
SetUseEdgeConnectionsvoid
# SetUseEdgeConnections
C#
public void SetUseEdgeConnections(bool enabled);
Parameters
NameTypeDefault
enabledbool—

Signals and events2

BakeFinishedEvent
# BakeFinished
C#
public event Action BakeFinished;

Emitted when a navigation polygon bake operation is completed.

NavigationPolygonChangedEvent
# NavigationPolygonChanged
C#
public event Action NavigationPolygonChanged;

Emitted when the used navigation polygon is replaced or changes to the internals of the current navigation polygon are committed.

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.