NavigationAgent3D

package
v0.0.0-...-f3deeb4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package NavigationAgent3D provides methods for working with NavigationAgent3D object instances.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsNavigationAgent3D() Instance
}

type Instance

type Instance [1]gdclass.NavigationAgent3D

A 3D agent used to pathfind to a position while avoiding static and dynamic obstacles. The calculation can be used by the parent node to dynamically move it along the path. Requires navigation data to work correctly. Dynamic obstacles are avoided using RVO collision avoidance. Avoidance is computed before physics, so the pathfinding information can be used safely in the physics step. [b]Note:[/b] After setting the [member target_position] property, the [method get_next_path_position] method must be used once every physics frame to update the internal path logic of the navigation agent. The vector position it returns should be used as the next movement position for the agent's parent node.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AsNavigationAgent3D

func (self Instance) AsNavigationAgent3D() Instance

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AvoidanceEnabled

func (self Instance) AvoidanceEnabled() bool

func (Instance) AvoidanceLayers

func (self Instance) AvoidanceLayers() int

func (Instance) AvoidanceMask

func (self Instance) AvoidanceMask() int

func (Instance) AvoidancePriority

func (self Instance) AvoidancePriority() Float.X

func (Instance) DebugEnabled

func (self Instance) DebugEnabled() bool

func (Instance) DebugPathCustomColor

func (self Instance) DebugPathCustomColor() Color.RGBA

func (Instance) DebugPathCustomPointSize

func (self Instance) DebugPathCustomPointSize() Float.X

func (Instance) DebugUseCustom

func (self Instance) DebugUseCustom() bool

func (Instance) DistanceToTarget

func (self Instance) DistanceToTarget() Float.X

Returns the distance to the target position, using the agent's global position. The user must set [member target_position] in order for this to be accurate.

func (Instance) GetAvoidanceLayerValue

func (self Instance) GetAvoidanceLayerValue(layer_number int) bool

Returns whether or not the specified layer of the [member avoidance_layers] bitmask is enabled, given a [param layer_number] between 1 and 32.

func (Instance) GetAvoidanceMaskValue

func (self Instance) GetAvoidanceMaskValue(mask_number int) bool

Returns whether or not the specified mask of the [member avoidance_mask] bitmask is enabled, given a [param mask_number] between 1 and 32.

func (Instance) GetCurrentNavigationPath

func (self Instance) GetCurrentNavigationPath() []Vector3.XYZ

Returns this agent's current path from start to finish in global coordinates. The path only updates when the target position is changed or the agent requires a repath. The path array is not intended to be used in direct path movement as the agent has its own internal path logic that would get corrupted by changing the path array manually. Use the intended [method get_next_path_position] once every physics frame to receive the next path point for the agents movement as this function also updates the internal path logic.

func (Instance) GetCurrentNavigationPathIndex

func (self Instance) GetCurrentNavigationPathIndex() int

Returns which index the agent is currently on in the navigation path's [PackedVector3Array].

func (Instance) GetCurrentNavigationResult

func (self Instance) GetCurrentNavigationResult() [1]gdclass.NavigationPathQueryResult3D

Returns the path query result for the path the agent is currently following.

func (Instance) GetFinalPosition

func (self Instance) GetFinalPosition() Vector3.XYZ

Returns the reachable final position of the current navigation path in global coordinates. This position can change if the agent needs to update the navigation path which makes the agent emit the [signal path_changed] signal.

func (Instance) GetNavigationLayerValue

func (self Instance) GetNavigationLayerValue(layer_number int) bool

Returns whether or not the specified layer of the [member navigation_layers] bitmask is enabled, given a [param layer_number] between 1 and 32.

func (Instance) GetNavigationMap

func (self Instance) GetNavigationMap() RID.NavigationMap3D

Returns the [RID] of the navigation map for this NavigationAgent node. This function returns always the map set on the NavigationAgent node and not the map of the abstract agent on the NavigationServer. If the agent map is changed directly with the NavigationServer API the NavigationAgent node will not be aware of the map change. Use [method set_navigation_map] to change the navigation map for the NavigationAgent and also update the agent on the NavigationServer.

func (Instance) GetNextPathPosition

func (self Instance) GetNextPathPosition() Vector3.XYZ

Returns the next position in global coordinates that can be moved to, making sure that there are no static objects in the way. If the agent does not have a navigation path, it will return the position of the agent's parent. The use of this function once every physics frame is required to update the internal path logic of the NavigationAgent.

func (Instance) GetRid

func (self Instance) GetRid() RID.NavigationAgent3D

Returns the [RID] of this agent on the [NavigationServer3D].

func (Instance) Height

func (self Instance) Height() Float.X

func (Instance) IsNavigationFinished

func (self Instance) IsNavigationFinished() bool

Returns [code]true[/code] if the agent's navigation has finished. If the target is reachable, navigation ends when the target is reached. If the target is unreachable, navigation ends when the last waypoint of the path is reached. [b]Note:[/b] While [code]true[/code] prefer to stop calling update functions like [method get_next_path_position]. This avoids jittering the standing agent due to calling repeated path updates.

func (Instance) IsTargetReachable

func (self Instance) IsTargetReachable() bool

Returns [code]true[/code] if [method get_final_position] is within [member target_desired_distance] of the [member target_position].

func (Instance) IsTargetReached

func (self Instance) IsTargetReached() bool

Returns [code]true[/code] if the agent reached the target, i.e. the agent moved within [member target_desired_distance] of the [member target_position]. It may not always be possible to reach the target but it should always be possible to reach the final position. See [method get_final_position].

func (Instance) KeepYVelocity

func (self Instance) KeepYVelocity() bool

func (Instance) MaxNeighbors

func (self Instance) MaxNeighbors() int

func (Instance) MaxSpeed

func (self Instance) MaxSpeed() Float.X

func (Instance) NavigationLayers

func (self Instance) NavigationLayers() int

func (Instance) NeighborDistance

func (self Instance) NeighborDistance() Float.X

func (Instance) OnLinkReached

func (self Instance) OnLinkReached(cb func(details map[any]any))

func (Instance) OnNavigationFinished

func (self Instance) OnNavigationFinished(cb func())

func (Instance) OnPathChanged

func (self Instance) OnPathChanged(cb func())

func (Instance) OnTargetReached

func (self Instance) OnTargetReached(cb func())

func (Instance) OnVelocityComputed

func (self Instance) OnVelocityComputed(cb func(safe_velocity Vector3.XYZ))

func (Instance) OnWaypointReached

func (self Instance) OnWaypointReached(cb func(details map[any]any))

func (Instance) PathDesiredDistance

func (self Instance) PathDesiredDistance() Float.X

func (Instance) PathHeightOffset

func (self Instance) PathHeightOffset() Float.X

func (Instance) PathMaxDistance

func (self Instance) PathMaxDistance() Float.X

func (Instance) Radius

func (self Instance) Radius() Float.X

func (Instance) SetAvoidanceEnabled

func (self Instance) SetAvoidanceEnabled(value bool)

func (Instance) SetAvoidanceLayerValue

func (self Instance) SetAvoidanceLayerValue(layer_number int, value bool)

Based on [param value], enables or disables the specified layer in the [member avoidance_layers] bitmask, given a [param layer_number] between 1 and 32.

func (Instance) SetAvoidanceLayers

func (self Instance) SetAvoidanceLayers(value int)

func (Instance) SetAvoidanceMask

func (self Instance) SetAvoidanceMask(value int)

func (Instance) SetAvoidanceMaskValue

func (self Instance) SetAvoidanceMaskValue(mask_number int, value bool)

Based on [param value], enables or disables the specified mask in the [member avoidance_mask] bitmask, given a [param mask_number] between 1 and 32.

func (Instance) SetAvoidancePriority

func (self Instance) SetAvoidancePriority(value Float.X)

func (Instance) SetDebugEnabled

func (self Instance) SetDebugEnabled(value bool)

func (Instance) SetDebugPathCustomColor

func (self Instance) SetDebugPathCustomColor(value Color.RGBA)

func (Instance) SetDebugPathCustomPointSize

func (self Instance) SetDebugPathCustomPointSize(value Float.X)

func (Instance) SetDebugUseCustom

func (self Instance) SetDebugUseCustom(value bool)

func (Instance) SetHeight

func (self Instance) SetHeight(value Float.X)

func (Instance) SetKeepYVelocity

func (self Instance) SetKeepYVelocity(value bool)

func (Instance) SetMaxNeighbors

func (self Instance) SetMaxNeighbors(value int)

func (Instance) SetMaxSpeed

func (self Instance) SetMaxSpeed(value Float.X)

func (Instance) SetNavigationLayerValue

func (self Instance) SetNavigationLayerValue(layer_number int, value bool)

Based on [param value], enables or disables the specified layer in the [member navigation_layers] bitmask, given a [param layer_number] between 1 and 32.

func (Instance) SetNavigationLayers

func (self Instance) SetNavigationLayers(value int)

func (Instance) SetNavigationMap

func (self Instance) SetNavigationMap(navigation_map RID.NavigationMap3D)

Sets the [RID] of the navigation map this NavigationAgent node should use and also updates the [code]agent[/code] on the NavigationServer.

func (Instance) SetNeighborDistance

func (self Instance) SetNeighborDistance(value Float.X)

func (Instance) SetPathDesiredDistance

func (self Instance) SetPathDesiredDistance(value Float.X)

func (Instance) SetPathHeightOffset

func (self Instance) SetPathHeightOffset(value Float.X)

func (Instance) SetPathMaxDistance

func (self Instance) SetPathMaxDistance(value Float.X)

func (Instance) SetPathMetadataFlags

func (self Instance) SetPathMetadataFlags(value gdclass.NavigationPathQueryParameters3DPathMetadataFlags)

func (Instance) SetPathPostprocessing

func (self Instance) SetPathPostprocessing(value gdclass.NavigationPathQueryParameters3DPathPostProcessing)

func (Instance) SetPathfindingAlgorithm

func (self Instance) SetPathfindingAlgorithm(value gdclass.NavigationPathQueryParameters3DPathfindingAlgorithm)

func (Instance) SetRadius

func (self Instance) SetRadius(value Float.X)

func (Instance) SetSimplifyEpsilon

func (self Instance) SetSimplifyEpsilon(value Float.X)

func (Instance) SetSimplifyPath

func (self Instance) SetSimplifyPath(value bool)

func (Instance) SetTargetDesiredDistance

func (self Instance) SetTargetDesiredDistance(value Float.X)

func (Instance) SetTargetPosition

func (self Instance) SetTargetPosition(value Vector3.XYZ)

func (Instance) SetTimeHorizonAgents

func (self Instance) SetTimeHorizonAgents(value Float.X)

func (Instance) SetTimeHorizonObstacles

func (self Instance) SetTimeHorizonObstacles(value Float.X)

func (Instance) SetUse3dAvoidance

func (self Instance) SetUse3dAvoidance(value bool)

func (Instance) SetVelocity

func (self Instance) SetVelocity(value Vector3.XYZ)

func (Instance) SetVelocityForced

func (self Instance) SetVelocityForced(velocity Vector3.XYZ)

Replaces the internal velocity in the collision avoidance simulation with [param velocity]. When an agent is teleported to a new position this function should be used in the same frame. If called frequently this function can get agents stuck.

func (Instance) SimplifyEpsilon

func (self Instance) SimplifyEpsilon() Float.X

func (Instance) SimplifyPath

func (self Instance) SimplifyPath() bool

func (Instance) TargetDesiredDistance

func (self Instance) TargetDesiredDistance() Float.X

func (Instance) TargetPosition

func (self Instance) TargetPosition() Vector3.XYZ

func (Instance) TimeHorizonAgents

func (self Instance) TimeHorizonAgents() Float.X

func (Instance) TimeHorizonObstacles

func (self Instance) TimeHorizonObstacles() Float.X

func (*Instance) UnsafePointer

func (self *Instance) UnsafePointer() unsafe.Pointer

func (Instance) Use3dAvoidance

func (self Instance) Use3dAvoidance() bool

func (Instance) Velocity

func (self Instance) Velocity() Vector3.XYZ

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL