reckfellENGINE

NavigationObstacle2D

2D obstacle used to affect navigation mesh baking or constrain velocities of avoidance controlled agents.

On this page
class NavigationObstacle2DReckfellSharpInherits Entity2D

2D obstacle used to affect navigation mesh baking or constrain velocities of avoidance controlled agents.

An obstacle needs a navigation map and outline NavigationObstacle2D.Vertices defined to work correctly. The outlines can not cross or overlap. Obstacles can be included in the navigation mesh baking process when NavigationObstacle2D.AffectNavigationMesh is enabled. They do not add walkable geometry, instead their role is to discard other source geometry inside the shape. This can be used to prevent navigation mesh from appearing in unwanted places. If NavigationObstacle2D.CarveNavigationMesh is enabled the baked shape will not be affected by offsets of the navigation mesh baking, e.g. the agent radius. With NavigationObstacle2D.AvoidanceEnabled the obstacle can constrain the avoidance velocities of avoidance using agents. If the obstacle's vertices are wound in clockwise order, avoidance agents will be pushed in by the obstacle, otherwise, avoidance agents will be pushed out. Obstacles using vertices and avoidance can warp to a new position but should not be moved every single frame as each change requires a rebuild of the avoidance map.

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

Constructors1

NavigationObstacle2DConstructor
# NavigationObstacle2D
C#
public NavigationObstacle2D();

Properties7

AffectNavigationMeshProperty
# AffectNavigationMesh
C#
public bool AffectNavigationMesh { get; set; }

Allows the obstacle Entity to contribute during bake-source parsing. Enabling does not automatically rebake existing output: the checked old route stayed straight until explicit baking.

AvoidanceEnabledProperty
# AvoidanceEnabled
C#
public bool AvoidanceEnabled { get; set; }

Enables obstacle participation in avoidance on its assigned map. Does not make it a physics wall or automatically change a baked route.

AvoidanceLayersProperty
# AvoidanceLayers
C#
public uint AvoidanceLayers { get; set; }

A bitfield determining the avoidance layers for this obstacle. Agents with a matching bit on the their avoidance mask will avoid this obstacle.

CarveNavigationMeshProperty
# CarveNavigationMesh
C#
public bool CarveNavigationMesh { get; set; }

Selects cutting after agent-radius offset during baking. A carve outline receives no additional radius clearance. Changing the flag does not itself start a bake.

RadiusProperty
# Radius
C#
public float Radius { get; set; }

Dynamic avoidance-obstacle radius. May also contribute to bake-source data when AffectNavigationMesh is enabled. Not a physics-collider radius.

VelocityProperty
# Velocity
C#
public Vector2 Velocity { get; set; }

The wanted velocity for the obstacle, used by other agents to better predict the obstacle if it is moved with a velocity regularly (every frame), instead of warped to a new position. Note: This property only affects avoidance for the obstacle's NavigationObstacle2D.Radius. Does nothing for the obstacle's static vertices.

VerticesProperty
# Vertices
C#
public Vector2[] Vertices { get; set; }

The outline vertices of the obstacle. If the vertices are winded in clockwise order, agents will be pushed in by the obstacle, otherwise they will be pushed out. Outlines cannot be crossed or overlap. If the obstacle is warped to a new position, agents cannot predict this movement and may get trapped inside the obstacle.

Methods20

GetAffectNavigationMeshbool
# GetAffectNavigationMesh
C#
public bool GetAffectNavigationMesh();
Returns bool
GetAvoidanceEnabledbool
# GetAvoidanceEnabled
C#
public bool GetAvoidanceEnabled();
Returns bool
GetAvoidanceLayerValuebool
# GetAvoidanceLayerValue
C#
public bool GetAvoidanceLayerValue(int layerNumber);

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

Parameters
NameTypeDefault
layerNumberint—
Returns bool
GetAvoidanceLayersuint
# GetAvoidanceLayers
C#
public uint GetAvoidanceLayers();
Returns uint
GetCarveNavigationMeshbool
# GetCarveNavigationMesh
C#
public bool GetCarveNavigationMesh();
Returns bool
GetNavigationMapRid
# GetNavigationMap
C#
public Rid GetNavigationMap();

Returns the Rid of the navigation map for this NavigationObstacle node. This function returns always the map set on the NavigationObstacle node and not the map of the abstract obstacle on the NavigationServer. If the obstacle map is changed directly with the NavigationServer API the NavigationObstacle node will not be aware of the map change. Use NavigationObstacle2D.SetNavigationMap to change the navigation map for the NavigationObstacle and also update the obstacle on the NavigationServer.

Returns Rid
GetRadiusfloat
# GetRadius
C#
public float GetRadius();
Returns float
GetRidRid
# GetRid
C#
public Rid GetRid();

Returns the Rid of this obstacle on the NavigationServer2D.

Returns Rid
GetVelocityVector2
# GetVelocity
C#
public Vector2 GetVelocity();
Returns Vector2
GetVerticesVector2[]
# GetVertices
C#
public Vector2[] GetVertices();
Returns Vector2[]
SetAffectNavigationMeshvoid
# SetAffectNavigationMesh
C#
public void SetAffectNavigationMesh(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetAvoidanceEnabledvoid
# SetAvoidanceEnabled
C#
public void SetAvoidanceEnabled(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetAvoidanceLayerValuevoid
# SetAvoidanceLayerValue
C#
public void SetAvoidanceLayerValue(int layerNumber, bool value);

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

Parameters
NameTypeDefault
layerNumberint—
valuebool—
SetAvoidanceLayersvoid
# SetAvoidanceLayers
C#
public void SetAvoidanceLayers(uint layers);
Parameters
NameTypeDefault
layersuint—
SetCarveNavigationMeshvoid
# SetCarveNavigationMesh
C#
public void SetCarveNavigationMesh(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetNavigationMapvoid
# SetNavigationMap
C#
public void SetNavigationMap(Rid navigationMap);

Sets the Rid of the navigation map this NavigationObstacle node should use and also updates the obstacle on the NavigationServer.

Parameters
NameTypeDefault
navigationMapRid—
SetRadiusvoid
# SetRadius
C#
public void SetRadius(float radius);
Parameters
NameTypeDefault
radiusfloat—
SetVelocityvoid
# SetVelocity
C#
public void SetVelocity(Vector2 velocity);
Parameters
NameTypeDefault
velocityVector2—
SetVertices2 overloads
# SetVertices · 1/2
C#
public void SetVertices(Vector2[] vertices);
Parameters
NameTypeDefault
verticesVector2[]—
# SetVertices · 2/2
C#
public void SetVertices(ReadOnlySpan<Vector2> vertices);
Parameters
NameTypeDefault
verticesReadOnlySpan<Vector2>—
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.