draw_navmesh
$navigation.draw_navmesh(navmesh: Reference)Visualize the given navmesh with debug lines.
| Parameter | Type | Meaning |
|---|---|---|
navmesh | Reference | The navmesh. |
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).
$navigation.draw_navmesh(navmesh: Reference)Visualize the given navmesh with debug lines.
| Parameter | Type | Meaning |
|---|---|---|
navmesh | Reference | The navmesh. |
$navigation.draw_navmesh_link(link: Component)Visualize the given navmesh link with debug lines.
| Parameter | Type | Meaning |
|---|---|---|
link | Component | The navmesh link. |
$navigation.draw_navmesh_obstacle_box(transform: Component)Visualize an obstacle box.
| Parameter | Type | Meaning |
|---|---|---|
transform | Component | Transform component |
$navigation.draw_navmesh_path(path: Reference)Visualize a path along a navmesh.
| Parameter | Type | Meaning |
|---|---|---|
path | Reference | The result of a navigation query. |
$navigation.find_closest_navmesh(position: vec3, search_distance: vec3) -> ReferenceGet the closest navmesh for the given position.
| Parameter | Type | Meaning |
|---|---|---|
position | vec3 | The position to search from. |
search_distance | vec3 | How far along each axis to raycast for navmesh polygon bounding boxes. |
Returns Reference: Handle to a navmesh instance.
$navigation.find_closest_point_on_navmesh(navmesh: Reference, point: vec3, search_distance: vec3, fallback: vec3) -> vec3Given a point, return the closest point clamped to the navmesh.
| Parameter | Type | Meaning |
|---|---|---|
navmesh | Reference | The navmesh to find the closest point on. |
point | vec3 | The point to clamp to the navmesh. |
search_distance | vec3 | How far along each axis to raycast for navmesh polygon bounding boxes. |
fallback | vec3 | The value to return if we fail to clamp to the navmesh. |
Returns vec3: The original point clamped to the given navmesh.
$navigation.find_path(navmesh: Reference, start_pos: vec3, end_pos: vec3, search_distance: vec3, include_flags: int, exclude_flags: int) -> ReferenceGiven 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.
| Parameter | Type | Meaning |
|---|---|---|
navmesh | Reference | Instance of the navmesh to query, likely the one closest to the start point. |
start_pos | vec3 | The start position |
end_pos | vec3 | The desired end position |
search_distance | vec3 | How far along each axis to raycast for navmesh polygon bounding boxes. |
include_flags | int | Bitmask for polygons that can be visited. Defaults to all 1 not specified. |
exclude_flags | int | Bitmask for polygons that should not be visted. Defaults to all 0 if not specified. |
Returns Reference: Handle to a path.
$navigation.get_path_has_valid_end_point(path: Reference) -> boolCheck if the path was able to find an end point on the navmesh.
| Parameter | Type | Meaning |
|---|---|---|
path | Reference | The result of a navigation query. |
Returns bool: True if the end point is valid, false otherwise.
$navigation.get_path_segment_count(path: Reference) -> intGet the number of segments in the given path.
| Parameter | Type | Meaning |
|---|---|---|
path | Reference | The result of a navigation query. |
Returns int: The number of segments in the path
$navigation.get_path_segment_end_navmesh(path: Reference, segment: int) -> ReferenceGet the navmesh the given segment ends on.
| Parameter | Type | Meaning |
|---|---|---|
path | Reference | The result of a navigation query. |
segment | int | Index of a segment. |
Returns Reference: The end navmesh.
$navigation.get_path_segment_end_point(path: Reference, segment: int, fallback: vec3) -> vec3Get the end point (in world space) of the given segment.
| Parameter | Type | Meaning |
|---|---|---|
path | Reference | The result of a navigation query. |
segment | int | Index of a segment. |
fallback | vec3 | Vector value to use as the destination if the next target position is invalid. |
Returns vec3: The end point, in world space.
$navigation.get_path_segment_flags(path: Reference, segment: int) -> intReturns a bitmask that contains the flags of the path segment.
| Parameter | Type | Meaning |
|---|---|---|
path | Reference | The result of a navigation query. |
segment | int | Index of a segment. |
Returns int: The bitmask of the navigation link flags.
$navigation.get_path_segment_length(path: Reference, segment: int) -> floatGet the length of the given segment.
| Parameter | Type | Meaning |
|---|---|---|
path | Reference | The result of a navigation query. |
segment | int | Index of a segment. |
Returns float: Length of the given segment.
$navigation.is_bounce_link(path: Reference, segment: int) -> boolReturn whether the AI can bounce traverse this link.
| Parameter | Type | Meaning |
|---|---|---|
path | Reference | The result of a navigation query. |
segment | int | Index of a segment. |
Returns bool: True if the AI can bounce to the next point, false otherwise.
$navigation.is_double_jump_link(path: Reference, segment: int) -> boolReturn whether the AI can double jump traverse this link.
| Parameter | Type | Meaning |
|---|---|---|
path | Reference | The result of a navigation query. |
segment | int | Index of a segment. |
Returns bool: True if the AI can double jump to the next point, false otherwise.
$navigation.is_glide_link(path: Reference, segment: int) -> boolReturn whether the AI can glide traverse this link.
| Parameter | Type | Meaning |
|---|---|---|
path | Reference | The result of a navigation query. |
segment | int | Index of a segment. |
Returns bool: True if the AI can glide to the next point, false otherwise.
$navigation.is_jump_link(path: Reference, segment: int) -> boolReturn whether the AI can jump traverse this link.
| Parameter | Type | Meaning |
|---|---|---|
path | Reference | The result of a navigation query. |
segment | int | Index of a segment. |
Returns bool: True if the AI can jump to the next point, false otherwise.
$navigation.is_navmesh_drawing_enabled() -> boolTrue if drawing navmesh is enabled.
Returns bool: True if drawing is enabled.
$navigation.is_navmesh_link_drawing_enabled() -> boolTrue if drawing navmesh links is enabled.
Returns bool: True if drawing is enabled.
$navigation.is_navmesh_path_drawing_enabled() -> boolTrue if drawing navmesh paths is enabled.
Returns bool: True if drawing is enabled.
$navigation.is_path_segment_link(path: Reference, segment: int) -> boolReturn true if the current segment is a link across a navmesh gap, false otherwise.
| Parameter | Type | Meaning |
|---|---|---|
path | Reference | The result of a navigation query. |
segment | int | Index of a segment. |
Returns bool: Whether or not the current segment is an off-mesh link.
$navigation.is_walk_link(path: Reference, segment: int) -> boolReturn whether the AI can walk traverse this link.
| Parameter | Type | Meaning |
|---|---|---|
path | Reference | The result of a navigation query. |
segment | int | Index of a segment. |
Returns bool: True if the AI can walk to the next point, false otherwise.
$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.
| Parameter | Type | Meaning |
|---|---|---|
obstacle | Component | The obstacle to enable or disable. |
transform | Component | Transform component |
enabled | bool | The status of the obstacle shape |
obstacle_index | int | The index to differntiate obstacles from the same component |
$navigation.update_navmesh(navmesh: Reference, transform: Component, allow_obstacles: bool)Update the given navmesh.
| Parameter | Type | Meaning |
|---|---|---|
navmesh | Reference | The navmesh to update. |
transform | Component | Transform component for this navmesh. |
allow_obstacles | bool | If true, allow obstacles to modify this navmesh. |
$navigation.update_navmesh_link(link: Component, transform: Component, subdivisions: int, bidirectional: bool, endpoint_search_distance: vec3, flags: int, end_position_override: vec3)Update the given navmesh link.
| Parameter | Type | Meaning |
|---|---|---|
link | Component | The navmesh link component to update. |
transform | Component | Transform component for this navmesh. |
subdivisions | int | Number of segments |
bidirectional | bool | True if this link can be traverse in either direction |
endpoint_search_distance | vec3 | Distance on each axis that segment end points can search for a valid navmesh connection. |
flags | int | Bitwise flags that indicate how to traverse this link. |
end_position_override | vec3 | Optional. If set, use this position as the end position of a live link instead of based on transform of this entity. |