Skip to content

$navigation

Path-finding for bots.

25 natives. Read-only natives only look things up; the rest change something. Parameter types use the language's names (Types).

draw_navmesh

$navigation.draw_navmesh(navmesh: Reference)

Visualize the given navmesh with debug lines.

ParameterTypeMeaning
navmeshReferenceThe navmesh.

draw_navmesh_obstacle_box

$navigation.draw_navmesh_obstacle_box(transform: Component)

Visualize an obstacle box.

ParameterTypeMeaning
transformComponentTransform component

draw_navmesh_path

$navigation.draw_navmesh_path(path: Reference)

Visualize a path along a navmesh.

ParameterTypeMeaning
pathReferenceThe result of a navigation query.

find_closest_navmesh

$navigation.find_closest_navmesh(position: vec3, search_distance: vec3) -> Reference

Get the closest navmesh for the given position.

ParameterTypeMeaning
positionvec3The position to search from.
search_distancevec3How far along each axis to raycast for navmesh polygon bounding boxes.

Returns Reference: Handle to a navmesh instance.

find_closest_point_on_navmesh

$navigation.find_closest_point_on_navmesh(navmesh: Reference, point: vec3, search_distance: vec3, fallback: vec3) -> vec3

Given a point, return the closest point clamped to the navmesh.

ParameterTypeMeaning
navmeshReferenceThe navmesh to find the closest point on.
pointvec3The point to clamp to the navmesh.
search_distancevec3How far along each axis to raycast for navmesh polygon bounding boxes.
fallbackvec3The value to return if we fail to clamp to the navmesh.

Returns vec3: The original point clamped to the given navmesh.

find_path

$navigation.find_path(navmesh: Reference, start_pos: vec3, end_pos: vec3, search_distance: vec3, include_flags: int, exclude_flags: int) -> Reference

Given a start and end point, find a path to the end point using the navigation system. WARNING: a path is only valid on the frame it's generated. Don't attempt to cache the return value of this function.

ParameterTypeMeaning
navmeshReferenceInstance of the navmesh to query, likely the one closest to the start point.
start_posvec3The start position
end_posvec3The desired end position
search_distancevec3How far along each axis to raycast for navmesh polygon bounding boxes.
include_flagsintBitmask for polygons that can be visited. Defaults to all 1 not specified.
exclude_flagsintBitmask for polygons that should not be visted. Defaults to all 0 if not specified.

Returns Reference: Handle to a path.

get_path_has_valid_end_point

$navigation.get_path_has_valid_end_point(path: Reference) -> bool

Check if the path was able to find an end point on the navmesh.

ParameterTypeMeaning
pathReferenceThe result of a navigation query.

Returns bool: True if the end point is valid, false otherwise.

get_path_segment_count

$navigation.get_path_segment_count(path: Reference) -> int

Get the number of segments in the given path.

ParameterTypeMeaning
pathReferenceThe result of a navigation query.

Returns int: The number of segments in the path

get_path_segment_end_navmesh

$navigation.get_path_segment_end_navmesh(path: Reference, segment: int) -> Reference

Get the navmesh the given segment ends on.

ParameterTypeMeaning
pathReferenceThe result of a navigation query.
segmentintIndex of a segment.

Returns Reference: The end navmesh.

get_path_segment_end_point

$navigation.get_path_segment_end_point(path: Reference, segment: int, fallback: vec3) -> vec3

Get the end point (in world space) of the given segment.

ParameterTypeMeaning
pathReferenceThe result of a navigation query.
segmentintIndex of a segment.
fallbackvec3Vector value to use as the destination if the next target position is invalid.

Returns vec3: The end point, in world space.

get_path_segment_flags

$navigation.get_path_segment_flags(path: Reference, segment: int) -> int

Returns a bitmask that contains the flags of the path segment.

ParameterTypeMeaning
pathReferenceThe result of a navigation query.
segmentintIndex of a segment.

Returns int: The bitmask of the navigation link flags.

get_path_segment_length

$navigation.get_path_segment_length(path: Reference, segment: int) -> float

Get the length of the given segment.

ParameterTypeMeaning
pathReferenceThe result of a navigation query.
segmentintIndex of a segment.

Returns float: Length of the given segment.

is_navmesh_drawing_enabled

$navigation.is_navmesh_drawing_enabled() -> bool

True if drawing navmesh is enabled.

Returns bool: True if drawing is enabled.

is_navmesh_path_drawing_enabled

$navigation.is_navmesh_path_drawing_enabled() -> bool

True if drawing navmesh paths is enabled.

Returns bool: True if drawing is enabled.

set_navmesh_obstacle_box_enabled

$navigation.set_navmesh_obstacle_box_enabled(obstacle: Component, transform: Component, enabled: bool, obstacle_index: int)

Toggle the status of an obstacle box. If enabled, the box will cut a hole in all overlapping navmeshes.

ParameterTypeMeaning
obstacleComponentThe obstacle to enable or disable.
transformComponentTransform component
enabledboolThe status of the obstacle shape
obstacle_indexintThe index to differntiate obstacles from the same component

update_navmesh

$navigation.update_navmesh(navmesh: Reference, transform: Component, allow_obstacles: bool)

Update the given navmesh.

ParameterTypeMeaning
navmeshReferenceThe navmesh to update.
transformComponentTransform component for this navmesh.
allow_obstaclesboolIf true, allow obstacles to modify this navmesh.