Navigation

    Mesh-based navigation and pathfinding node.

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

    Provides navigation and pathfinding within a collection of es. 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

    Methods

    get_closest_point ( to_point ) const

    Vector3

    ( Vector3 to_point ) const

    Vector3

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

    get_rid ( ) const

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

    • map_changed ( map )

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

    Property Descriptions

    • 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.


    • 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 path query.


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

    • get_closest_point ( Vector3 to_point ) const

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


    • get_closest_point_normal ( Vector3 to_point ) const

    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.


    • get_closest_point_owner ( Vector3 to_point ) const

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


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

    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.


    • get_rid ( ) const

    Returns the RID of the navigation map on the .


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