Navigation

Inherits: Spatial < Node < Object

Mesh-based navigation and pathfinding node.

Description

Deprecated. Navigation node and get_simple_path are deprecated and will be removed in a future version. Use NavigationServer.map_get_path instead.

Provides navigation and pathfinding within a collection of NavigationMeshes. By default, these will be automatically collected from child NavigationMeshInstance nodes. In addition to basic pathfinding, this class also assists with aligning navigation agents with the meshes they are navigating on.

Tutorials

Properties

float

cell_height

0.25

float

cell_size

0.25

float

edge_connection_margin

0.25

int

navigation_layers

1

Vector3

up_vector

Vector3( 0, 1, 0 )

Methods

Vector3

get_closest_point ( Vector3 to_point ) const

Vector3

get_closest_point_normal ( Vector3 to_point ) const

RID

get_closest_point_owner ( Vector3 to_point ) const

Vector3

get_closest_point_to_segment ( Vector3 start, Vector3 end, bool use_collision=false ) const

RID

get_rid ( ) const

PoolVector3Array

get_simple_path ( Vector3 start, Vector3 end, bool optimize=true ) const

Signals

  • map_changed ( RID map )

Emitted when a navigation map is updated, when a region moves or is modified.

Property Descriptions

Default

0.25

Setter

set_cell_height(value)

Getter

get_cell_height()

The cell height to use for fields.


Default

0.25

Setter

set_cell_size(value)

Getter

get_cell_size()

The XZ plane cell size to use for fields.


  • float edge_connection_margin

Default

0.25

Setter

set_edge_connection_margin(value)

Getter

get_edge_connection_margin()

This value is used to detect the near edges to connect compatible regions.


  • int navigation_layers

Default

1

Setter

set_navigation_layers(value)

Getter

get_navigation_layers()

A bitfield determining all navigation map layers the navigation can use on a get_simple_path path query.


Default

Vector3( 0, 1, 0 )

Setter

set_up_vector(value)

Getter

get_up_vector()

Defines which direction is up. By default, this is (0, 1, 0), which is the world’s “up” direction.

Method Descriptions

Returns the navigation point closest to the point given. Points are in local coordinate space.


Returns the surface normal at the navigation point closest to the point given. Useful for rotating a navigation agent according to the navigation mesh it moves on.


  • RID get_closest_point_owner ( Vector3 to_point ) const

Returns the owner of the NavigationMesh which contains the navigation point closest to the point given. This is usually a NavigationMeshInstance.


Returns the navigation point closest to the given line segment. When enabling use_collision, only considers intersection points between segment and navigation meshes. If multiple intersection points are found, the one closest to the segment start point is returned.


  • RID get_rid ( ) const

Returns the RID of the navigation map on the NavigationServer.


Deprecated. Navigation node and get_simple_path are deprecated and will be removed in a future version. Use NavigationServer.map_get_path instead.

Returns the path between two given points. Points are in local coordinate space. If optimize is true (the default), the agent properties associated with each NavigationMesh (radius, height, etc.) are considered in the path calculation, otherwise they are ignored.