Navigation2D¶
Inherits: Node2D < CanvasItem < Node < Object
2D navigation and pathfinding node.
Description¶
Deprecated. Navigation2D node and get_simple_path are deprecated and will be removed in a future version. Use Navigation2DServer.map_get_path instead.
Navigation2D provides navigation and pathfinding within a 2D area, specified as a collection of NavigationPolygon resources. By default, these are automatically collected from child NavigationPolygonInstance nodes.
Tutorials¶
Properties¶
|
||
|
||
|
Methods¶
get_closest_point ( Vector2 to_point ) const |
|
get_closest_point_owner ( Vector2 to_point ) const |
|
get_rid ( ) const |
|
get_simple_path ( Vector2 start, Vector2 end, bool optimize=true ) const |
Property Descriptions¶
float cell_size = 1.0
The XY plane cell size to use for fields.
float edge_connection_margin = 1.0
This value is used to detect the near edges to connect compatible regions.
int navigation_layers = 1
A bitfield determining all navigation map layers the navigation can use on a get_simple_path path query.
Method Descriptions¶
Vector2 get_closest_point ( Vector2 to_point ) const
Returns the navigation point closest to the point given. Points are in local coordinate space.
RID get_closest_point_owner ( Vector2 to_point ) const
Returns the owner of the NavigationPolygon which contains the navigation point closest to the point given. This is usually a NavigationPolygonInstance.
RID get_rid ( ) const
Returns the object's RID.
PoolVector2Array get_simple_path ( Vector2 start, Vector2 end, bool optimize=true ) const
Deprecated. Navigation2D node and get_simple_path are deprecated and will be removed in a future version. Use Navigation2DServer.map_get_path instead.
Returns the path between two given points. Points are in local coordinate space. If optimize
is true
(the default), the path is smoothed by merging path segments where possible.