Table of Contents

Class NavigationObstacle3D

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

Inheritance
NavigationObstacle3D

An obstacle needs a navigation map and outline vertices defined to work correctly. The outlines can not cross or overlap and are restricted to a plane projection. This means the y-axis of the vertices is ignored, instead the obstacle's global y-axis position is used for placement. The projected shape is extruded by the obstacles height along the y-axis.

Obstacles can be included in the navigation mesh baking process when affect_navigation_mesh 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, e.g. inside "solid" geometry or on top of it. If carve_navigation_mesh is enabled the baked shape will not be affected by offsets of the navigation mesh baking, e.g. the agent radius.

With avoidance_enabled 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.

See Also

Properties

If enabled and parsed in a navigation mesh baking process the obstacle will discard source geometry inside its vertices and height defined shape.

var affect_navigation_mesh : bool = false

Property Value

bool
  • void set_affect_navigation_mesh(bool value)
  • bool get_affect_navigation_mesh

If true the obstacle affects avoidance using agents.

var avoidance_enabled : bool = true

Property Value

bool
  • void set_avoidance_enabled(bool value)
  • bool get_avoidance_enabled

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

var avoidance_layers : int = 1

Property Value

int
  • void set_avoidance_layers(int value)
  • int get_avoidance_layers

If enabled the obstacle vertices will carve into the baked navigation mesh with the shape unaffected by additional offsets (e.g. agent radius).

It will still be affected by further postprocessing of the baking process, like edge and polygon simplification.

Requires affect_navigation_mesh to be enabled.

var carve_navigation_mesh : bool = false

Property Value

bool
  • void set_carve_navigation_mesh(bool value)
  • bool get_carve_navigation_mesh

Sets the obstacle height used in 2D avoidance. 2D avoidance using agent's ignore obstacles that are below or above them.

var height : float = 1.0

Property Value

float

Sets the avoidance radius for the obstacle.

var radius : float = 0.0

Property Value

float

If true the obstacle affects 3D avoidance using agent's with obstacle radius.

If false the obstacle affects 2D avoidance using agent's with both obstacle vertices as well as obstacle radius.

var use_3d_avoidance : bool = false

Property Value

bool
  • void set_use_3d_avoidance(bool value)
  • bool get_use_3d_avoidance

Sets the wanted velocity for the obstacle so other agent's can better predict the obstacle if it is moved with a velocity regularly (every frame) instead of warped to a new position. Does only affect avoidance for the obstacles radius. Does nothing for the obstacles static vertices.

var velocity : Vector3 = Vector3(0, 0, 0)

Property Value

Vector3

The outline vertices of the obstacle. If the vertices are winded in clockwise order agents will be pushed in by the obstacle, else they will be pushed out. Outlines can not be crossed or overlap. Should the vertices using obstacle be warped to a new position agent's can not predict this movement and may get trapped inside the obstacle.

var vertices : PackedVector3Array = PackedVector3Array()

Property Value

PackedVector3Array

Methods

Qualifiers: const

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

bool get_avoidance_layer_value(int layer_number)

Parameters

layer_number int

Qualifiers: const

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 NavigationObstacle3D.set_navigation_map to change the navigation map for the NavigationObstacle and also update the obstacle on the NavigationServer.

RID get_navigation_map

Qualifiers: const

Returns the RID of this obstacle on the NavigationServer3D.

RID get_rid

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

void set_avoidance_layer_value(int layer_number, bool value)

Parameters

layer_number int
value bool

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

void set_navigation_map(RID navigation_map)

Parameters

navigation_map RID