NavigationLink2D
A link between two positions on NavigationRegion2Ds that agents can be routed through.
A link between two positions on NavigationRegion2Ds that agents can be routed through.
A link between two positions on NavigationRegion2Ds that agents can be routed through. These positions can be on the same NavigationRegion2D or on two different ones. Links are useful to express navigation methods other than traveling along the surface of the navigation polygon, such as ziplines, teleporters, or gaps that can be jumped across.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
NavigationLink2DConstructor
public NavigationLink2D();Properties7
BidirectionalProperty
public bool Bidirectional { get; set; }Whether this link can be traveled in both directions or only from NavigationLink2D.StartPosition to NavigationLink2D.EndPosition.
EnabledProperty
public bool Enabled { get; set; }Whether this link is currently active. If false, NavigationServer2D.MapGetPath will ignore this link.
EndPositionProperty
public Vector2 EndPosition { get; set; }End endpoint in the link Entity local coordinates. Moving the Entity updates server-global endpoints; this position does not teleport a gameplay body.
EnterCostProperty
public float EnterCost { get; set; }When pathfinding enters this link from another region's navigation mesh the NavigationLink2D.EnterCost value is added to the path distance for determining the shortest path.
NavigationLayersProperty
public uint NavigationLayers { get; set; }A bitfield determining all navigation layers the link belongs to. These navigation layers will be checked when requesting a path with NavigationServer2D.MapGetPath.
StartPositionProperty
public Vector2 StartPosition { get; set; }Start endpoint in the link Entity local coordinates. Transformed by the Entity global transform before submission to the server. Server LinkSetStartPosition expects a global position instead.
TravelCostProperty
public float TravelCost { get; set; }When pathfinding moves along the link the traveled distance is multiplied with NavigationLink2D.TravelCost for determining the shortest path.
Methods23
GetEndPositionVector2
public Vector2 GetEndPosition();Vector2GetEnterCostfloat
public float GetEnterCost();floatGetGlobalEndPositionVector2
public Vector2 GetGlobalEndPosition();Returns the NavigationLink2D.EndPosition that is relative to the link as a global position.
Vector2GetGlobalStartPositionVector2
public Vector2 GetGlobalStartPosition();Returns the NavigationLink2D.StartPosition that is relative to the link as a global position.
Vector2GetNavigationLayerValuebool
public bool GetNavigationLayerValue(int layerNumber);Returns whether or not the specified layer of the NavigationLink2D.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 link.
RidGetRidRid
public Rid GetRid();Returns the Rid of this link on the NavigationServer2D.
RidGetStartPositionVector2
public Vector2 GetStartPosition();Vector2GetTravelCostfloat
public float GetTravelCost();floatIsBidirectionalbool
public bool IsBidirectional();boolIsEnabledbool
public bool IsEnabled();boolSetBidirectionalvoid
public void SetBidirectional(bool bidirectional);| Name | Type | Default |
|---|---|---|
bidirectional | bool | — |
SetEnabledvoid
public void SetEnabled(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
SetEndPositionvoid
public void SetEndPosition(Vector2 position);| Name | Type | Default |
|---|---|---|
position | Vector2 | — |
SetEnterCostvoid
public void SetEnterCost(float enterCost);| Name | Type | Default |
|---|---|---|
enterCost | float | — |
SetGlobalEndPositionvoid
public void SetGlobalEndPosition(Vector2 position);Sets the NavigationLink2D.EndPosition that is relative to the link from a global position.
| Name | Type | Default |
|---|---|---|
position | Vector2 | — |
SetGlobalStartPositionvoid
public void SetGlobalStartPosition(Vector2 position);Sets the NavigationLink2D.StartPosition that is relative to the link from a global position.
| Name | Type | Default |
|---|---|---|
position | Vector2 | — |
SetNavigationLayerValuevoid
public void SetNavigationLayerValue(int layerNumber, bool value);Based on value, enables or disables the specified layer in the NavigationLink2D.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 link should use. By default the link will automatically join the World2D default navigation map so this function is only required to override the default map.
| Name | Type | Default |
|---|---|---|
navigationMap | Rid | — |
SetStartPositionvoid
public void SetStartPosition(Vector2 position);| Name | Type | Default |
|---|---|---|
position | Vector2 | — |
SetTravelCostvoid
public void SetTravelCost(float travelCost);| Name | Type | Default |
|---|---|---|
travelCost | float | — |