Navigation

Mesh-based navigation and pathfinding node.

Provides navigation and pathfinding within a collection of NavigationMeshes. By default, these will be automatically collected from child NavigationMeshInstance nodes, but they can also be added on the fly with navmeshAdd. In addition to basic pathfinding, this class also assists with aligning navigation agents with the meshes they are navigating on. Note: The current navigation system has many known issues and will not always return optimal paths as expected. These issues will be fixed in Godot 4.0.

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Functions

getClosestPoint
Vector3 getClosestPoint(Vector3 to_point)

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

getClosestPointNormal
Vector3 getClosestPointNormal(Vector3 to_point)

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.

getClosestPointOwner
GodotObject getClosestPointOwner(Vector3 to_point)

Returns the owner of the NavigationMesh which contains the navigation point closest to the point given. This is usually a NavigationMeshInstance. For meshes added via navmeshAdd, returns the owner that was given (or null if the owner parameter was omitted).

getClosestPointToSegment
Vector3 getClosestPointToSegment(Vector3 start, Vector3 end, bool use_collision)

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.

getSimplePath
PoolVector3Array getSimplePath(Vector3 start, Vector3 end, bool optimize)

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. Note: This method has known issues and will often return non-optimal paths. These issues will be fixed in Godot 4.0.

getUpVector
Vector3 getUpVector()
navmeshAdd
long navmeshAdd(NavigationMesh mesh, Transform xform, GodotObject owner)

Adds a NavigationMesh. Returns an ID for use with navmeshRemove or navmeshSetTransform. If given, a Transform2D is applied to the polygon. The optional owner is used as return value for getClosestPointOwner.

navmeshRemove
void navmeshRemove(long id)

Removes the NavigationMesh with the given ID.

navmeshSetTransform
void navmeshSetTransform(long id, Transform xform)

Sets the transform applied to the NavigationMesh with the given ID.

opAssign
typeof(null) opAssign(typeof(null) n)
opEquals
bool opEquals(Navigation other)
opEquals
bool opEquals(typeof(null) n)
setUpVector
void setUpVector(Vector3 up)
toHash
size_t toHash()

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Properties

upVector
Vector3 upVector [@property getter]
Vector3 upVector [@property setter]

Defines which direction is up. By default, this is (0, 1, 0), which is the world's "up" direction.

Static functions

_new
Navigation _new()

Construct a new instance of Navigation. Note: use memnew!Navigation instead.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

GDNativeClassBinding
struct GDNativeClassBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(ToRef) as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta