Struct Navigation

Mesh-based navigation and pathfinding node.

struct Navigation ;

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.

Properties

NameTypeDescription
upVector[get, set] Vector3Defines which direction is up. By default, this is (0, 1, 0), which is the world's "up" direction.

Methods

NameDescription
getClosestPoint Returns the navigation point closest to the point given. Points are in local coordinate space.
getClosestPointNormal 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 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 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 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.
getUpVector
navmeshAdd 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 Removes the NavigationMesh with the given ID.
navmeshSetTransform Sets the transform applied to the NavigationMesh with the given ID.
setUpVector