Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
NavigationObstacle2D¶
Inherits: Node2D < CanvasItem < Node < Object
2D Obstacle used in navigation to constrain avoidance controlled agents outside or inside an area.
Description¶
2D Obstacle used in navigation to constrain avoidance controlled agents outside or inside an area. The obstacle needs a navigation map and outline vertices defined to work correctly.
If the obstacle's vertices are winded in clockwise order, avoidance agents will be pushed in by the obstacle, otherwise, avoidance agents will be pushed out. Outlines must not cross or overlap.
Obstacles are not a replacement for a (re)baked navigation mesh. Obstacles don't change the resulting path from the pathfinding, obstacles only affect the navigation avoidance agent movement by altering the suggested velocity of the avoidance agent.
Obstacles using vertices can warp to a new position but should not moved every frame as each move requires a rebuild of the avoidance map.
Tutorials¶
Properties¶
|
||
|
||
|
||
|
||
|
Methods¶
get_avoidance_layer_value ( int layer_number ) const |
|
get_navigation_map ( ) const |
|
get_rid ( ) const |
|
void |
set_avoidance_layer_value ( int layer_number, bool value ) |
void |
set_navigation_map ( RID navigation_map ) |
Property Descriptions¶
bool avoidance_enabled = true
If true
the obstacle affects avoidance using agents.
int avoidance_layers = 1
A bitfield determining the avoidance layers for this obstacle. Agents with a matching bit on the their avoidance mask will avoid this obstacle.
float radius = 0.0
Sets the avoidance radius for the obstacle.
Vector2 velocity = Vector2(0, 0)
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