NavigationRegion3D
A traversable 3D region that NavigationAgent3Ds can use for pathfinding.
A traversable 3D region that NavigationAgent3Ds can use for pathfinding.
A traversable 3D region based on a NavigationMesh that NavigationAgent3Ds 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 NavigationServer3D.MapSetEdgeConnectionMargin.
Note: Overlapping two regions' navigation meshes is not enough for connecting two regions. They must share a similar edge.
The cost of entering this region from another region can be controlled with the NavigationRegion3D.EnterCost value.
Note: This value is not added to the path cost when the start position is already inside this region.
The cost of traveling distances inside this region can be controlled with the NavigationRegion3D.TravelCost multiplier.
Note: This node caches changes to its properties, so if you make changes to the underlying region Rid in NavigationServer3D, 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
NavigationRegion3DConstructor
public NavigationRegion3D();Properties6
EnabledProperty
public bool Enabled { get; set; }Determines if the NavigationRegion3D is enabled or disabled.
EnterCostProperty
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
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 NavigationServer3D.MapGetPath.
NavigationMeshProperty
public NavigationMesh NavigationMesh { get; set; }The NavigationMesh resource to use.
TravelCostProperty
public float TravelCost { get; set; }When pathfinding moves inside this region's navigation mesh the traveled distances are multiplied with NavigationRegion3D.TravelCost for determining the shortest path.
UseEdgeConnectionsProperty
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
BakeNavigationMeshvoid
public void BakeNavigationMesh(bool onThread = true);Bakes the NavigationMesh. If on_thread is set to true (default), the baking is done on a separate thread. Baking on separate thread is useful because navigation baking is not a cheap operation. When it is completed, it automatically sets the new NavigationMesh. Please note that baking on separate thread may be very slow if geometry is parsed from meshes as async access to each mesh involves heavy synchronization. Also, please note that baking on a separate thread is automatically disabled on operating systems that cannot use threads (such as Web with threads disabled).
| Name | Type | Default |
|---|---|---|
onThread | bool | true |
GetBoundsAabb
public Aabb GetBounds();Returns the axis-aligned bounding box for the region's transformed navigation mesh.
AabbGetEnterCostfloat
public float GetEnterCost();floatGetNavigationLayerValuebool
public bool GetNavigationLayerValue(int layerNumber);Returns whether or not the specified layer of the NavigationRegion3D.NavigationLayers bitmask is enabled, given a layer_number between 1 and 32.
| Name | Type | Default |
|---|---|---|
layerNumber | int | — |
boolGetNavigationLayersuint
public uint GetNavigationLayers();uintGetNavigationMapRid
public Rid GetNavigationMap();Returns the current navigation map Rid used by this region.
RidGetNavigationMeshNavigationMesh
public NavigationMesh GetNavigationMesh();NavigationMeshGetRegionRidRid · Deprecated
public Rid GetRegionRid();Returns the Rid of this region on the NavigationServer3D.
RidGetRidRid
public Rid GetRid();Returns the Rid of this region on the NavigationServer3D. Combined with NavigationServer3D.MapGetClosestPointOwner can be used to identify the NavigationRegion3D closest to a point on the merged navigation map.
RidGetTravelCostfloat
public float GetTravelCost();floatGetUseEdgeConnectionsbool
public bool GetUseEdgeConnections();boolIsBakingbool
public bool IsBaking();Returns true when the NavigationMesh is being baked on a background thread.
boolIsEnabledbool
public bool IsEnabled();boolSetEnabledvoid
public void SetEnabled(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
SetEnterCostvoid
public void SetEnterCost(float enterCost);| Name | Type | Default |
|---|---|---|
enterCost | float | — |
SetNavigationLayerValuevoid
public void SetNavigationLayerValue(int layerNumber, bool value);Based on value, enables or disables the specified layer in the NavigationRegion3D.NavigationLayers bitmask, given a layer_number between 1 and 32.
| Name | Type | Default |
|---|---|---|
layerNumber | int | — |
value | bool | — |
SetNavigationLayersvoid
public void SetNavigationLayers(uint navigationLayers);| Name | Type | Default |
|---|---|---|
navigationLayers | uint | — |
SetNavigationMapvoid
public void SetNavigationMap(Rid navigationMap);Sets the Rid of the navigation map this region should use. By default the region will automatically join the World3D default navigation map so this function is only required to override the default map.
| Name | Type | Default |
|---|---|---|
navigationMap | Rid | — |
SetNavigationMeshvoid
public void SetNavigationMesh(NavigationMesh navigationMesh);| Name | Type | Default |
|---|---|---|
navigationMesh | NavigationMesh | — |
SetTravelCostvoid
public void SetTravelCost(float travelCost);| Name | Type | Default |
|---|---|---|
travelCost | float | — |
SetUseEdgeConnectionsvoid
public void SetUseEdgeConnections(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
Signals and events2
BakeFinishedEvent
public event Action BakeFinished;Notifies when the navigation mesh bake operation is completed.
NavigationMeshChangedEvent
public event Action NavigationMeshChanged;Notifies when the NavigationMesh has changed.