Documentation
¶
Overview ¶
By changing various properties of this object, such as the start and target position, you can configure path queries to the NavigationServer2D.
Index ¶
- type Advanced
- type Any
- type Extension
- type ID
- type Instance
- func (self Instance) AsNavigationPathQueryParameters2D() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) ExcludedRegions() []RID.Any
- func (self Instance) ID() ID
- func (self Instance) IncludedRegions() []RID.Any
- func (self Instance) Map() RID.NavigationMap2D
- func (self Instance) MetadataFlags() PathMetadataFlags
- func (self Instance) NavigationLayers() int
- func (self Instance) PathPostprocessing() PathPostProcessing
- func (self Instance) PathReturnMaxLength() Float.X
- func (self Instance) PathReturnMaxRadius() Float.X
- func (self Instance) PathSearchMaxDistance() Float.X
- func (self Instance) PathSearchMaxPolygons() int
- func (self Instance) PathfindingAlgorithm() PathfindingAlgorithm
- func (self Instance) SetExcludedRegions(value []RID.Any)
- func (self Instance) SetIncludedRegions(value []RID.Any)
- func (self Instance) SetMap(value RID.NavigationMap2D)
- func (self Instance) SetMetadataFlags(value PathMetadataFlags)
- func (self Instance) SetNavigationLayers(value int)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetPathPostprocessing(value PathPostProcessing)
- func (self Instance) SetPathReturnMaxLength(value Float.X)
- func (self Instance) SetPathReturnMaxRadius(value Float.X)
- func (self Instance) SetPathSearchMaxDistance(value Float.X)
- func (self Instance) SetPathSearchMaxPolygons(value int)
- func (self Instance) SetPathfindingAlgorithm(value PathfindingAlgorithm)
- func (self Instance) SetSimplifyEpsilon(value Float.X)
- func (self Instance) SetSimplifyPath(value bool)
- func (self Instance) SetStartPosition(value Vector2.XY)
- func (self Instance) SetTargetPosition(value Vector2.XY)
- func (self Instance) SimplifyEpsilon() Float.X
- func (self Instance) SimplifyPath() bool
- func (self Instance) StartPosition() Vector2.XY
- func (self Instance) TargetPosition() Vector2.XY
- func (self Instance) Virtual(name string) reflect.Value
- type PathMetadataFlags
- type PathPostProcessing
- type PathfindingAlgorithm
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 Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsNavigationPathQueryParameters2D ¶
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
type Instance [1]gdclass.NavigationPathQueryParameters2D
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsNavigationPathQueryParameters2D ¶
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) ExcludedRegions ¶
The list of region Resource.IDs that will be excluded from the path query. Use NavigationRegion2D.GetRid to get the Resource.ID associated with a NavigationRegion2D node.
Note: The returned array is copied and any changes to it will not update the original property value. To update the value you need to modify the returned array, and then set it to the property again.
func (Instance) IncludedRegions ¶
The list of region Resource.IDs that will be included by the path query. Use NavigationRegion2D.GetRid to get the Resource.ID associated with a NavigationRegion2D node. If left empty all regions are included. If a region ends up being both included and excluded at the same time it will be excluded.
Note: The returned array is copied and any changes to it will not update the original property value. To update the value you need to modify the returned array, and then set it to the property again.
func (Instance) Map ¶
func (self Instance) Map() RID.NavigationMap2D
The navigation map Resource.ID used in the path query.
func (Instance) MetadataFlags ¶
func (self Instance) MetadataFlags() PathMetadataFlags
Additional information to include with the navigation path.
func (Instance) NavigationLayers ¶
The navigation layers the query will use (as a bitmask).
func (Instance) PathPostprocessing ¶
func (self Instance) PathPostprocessing() PathPostProcessing
The path postprocessing applied to the raw path corridor found by the PathfindingAlgorithm.
func (Instance) PathReturnMaxLength ¶
The maximum allowed length of the returned path in world units. A path will be clipped when going over this length. A value of 0 or below counts as disabled.
func (Instance) PathReturnMaxRadius ¶
The maximum allowed radius in world units that the returned path can be from the path start. The path will be clipped when going over this radius. A value of 0 or below counts as disabled.
Note: This will perform a circle shaped clip operation on the path with the first path position being the circle's center position.
func (Instance) PathSearchMaxDistance ¶
The maximum distance a searched polygon can be away from the start polygon before the pathfinding cancels the search for a path to the (possibly unreachable or very far away) target position polygon. In this case the pathfinding resets and builds a path from the start polygon to the polygon that was found closest to the target position so far. A value of 0 or below counts as unlimited. In case of unlimited the pathfinding will search all polygons connected with the start polygon until either the target position polygon is found or all available polygon search options are exhausted.
func (Instance) PathSearchMaxPolygons ¶
The maximum number of polygons that are searched before the pathfinding cancels the search for a path to the (possibly unreachable or very far away) target position polygon. In this case the pathfinding resets and builds a path from the start polygon to the polygon that was found closest to the target position so far. A value of 0 or below counts as unlimited. In case of unlimited the pathfinding will search all polygons connected with the start polygon until either the target position polygon is found or all available polygon search options are exhausted.
func (Instance) PathfindingAlgorithm ¶
func (self Instance) PathfindingAlgorithm() PathfindingAlgorithm
The pathfinding algorithm used in the path query.
func (Instance) SetExcludedRegions ¶
SetExcludedRegions sets the property returned by [GetExcludedRegions].
func (Instance) SetIncludedRegions ¶
SetIncludedRegions sets the property returned by [GetIncludedRegions].
func (Instance) SetMap ¶
func (self Instance) SetMap(value RID.NavigationMap2D)
SetMap sets the property returned by [GetMap].
func (Instance) SetMetadataFlags ¶
func (self Instance) SetMetadataFlags(value PathMetadataFlags)
SetMetadataFlags sets the property returned by [GetMetadataFlags].
func (Instance) SetNavigationLayers ¶
SetNavigationLayers sets the property returned by [GetNavigationLayers].
func (Instance) SetPathPostprocessing ¶
func (self Instance) SetPathPostprocessing(value PathPostProcessing)
SetPathPostprocessing sets the property returned by [GetPathPostprocessing].
func (Instance) SetPathReturnMaxLength ¶
SetPathReturnMaxLength sets the property returned by [GetPathReturnMaxLength].
func (Instance) SetPathReturnMaxRadius ¶
SetPathReturnMaxRadius sets the property returned by [GetPathReturnMaxRadius].
func (Instance) SetPathSearchMaxDistance ¶
SetPathSearchMaxDistance sets the property returned by [GetPathSearchMaxDistance].
func (Instance) SetPathSearchMaxPolygons ¶
SetPathSearchMaxPolygons sets the property returned by [GetPathSearchMaxPolygons].
func (Instance) SetPathfindingAlgorithm ¶
func (self Instance) SetPathfindingAlgorithm(value PathfindingAlgorithm)
SetPathfindingAlgorithm sets the property returned by [GetPathfindingAlgorithm].
func (Instance) SetSimplifyEpsilon ¶
SetSimplifyEpsilon sets the property returned by [GetSimplifyEpsilon].
func (Instance) SetSimplifyPath ¶
SetSimplifyPath sets the property returned by [GetSimplifyPath].
func (Instance) SetStartPosition ¶
SetStartPosition sets the property returned by [GetStartPosition].
func (Instance) SetTargetPosition ¶
SetTargetPosition sets the property returned by [GetTargetPosition].
func (Instance) SimplifyEpsilon ¶
The path simplification amount in worlds units.
func (Instance) SimplifyPath ¶
If true a simplified version of the path will be returned with less critical path points removed. The simplification amount is controlled by SimplifyEpsilon. The simplification uses a variant of Ramer-Douglas-Peucker algorithm for curve point decimation.
Path simplification can be helpful to mitigate various path following issues that can arise with certain agent types and script behaviors. E.g. "steering" agents or avoidance in "open fields".
func (Instance) StartPosition ¶
The pathfinding start position in global coordinates.
func (Instance) TargetPosition ¶
The pathfinding target position in global coordinates.
type PathMetadataFlags ¶
type PathMetadataFlags int //gd:NavigationPathQueryParameters2D.PathMetadataFlags
const ( // Don't include any additional metadata about the returned path. PathMetadataIncludeNone PathMetadataFlags = 0 // Include the type of navigation primitive (region or link) that each point of the path goes through. PathMetadataIncludeTypes PathMetadataFlags = 1 // Include the [Resource.ID]s of the regions and links that each point of the path goes through. // // [Resource.ID]: https://pkg.go.dev/graphics.gd/variant/Resource#ID PathMetadataIncludeRids PathMetadataFlags = 2 // Include the ObjectIDs of the [Object]s which manage the regions and links each point of the path goes through. // // [Object]: https://pkg.go.dev/graphics.gd/variant/Object PathMetadataIncludeOwners PathMetadataFlags = 4 // Include all available metadata about the returned path. PathMetadataIncludeAll PathMetadataFlags = 7 )
type PathPostProcessing ¶
type PathPostProcessing int //gd:NavigationPathQueryParameters2D.PathPostProcessing
const ( // Applies a funnel algorithm to the raw path corridor found by the pathfinding algorithm. This will result in the shortest path possible inside the path corridor. This postprocessing very much depends on the navigation mesh polygon layout and the created corridor. Especially tile- or gridbased layouts can face artificial corners with diagonal movement due to a jagged path corridor imposed by the cell shapes. PathPostprocessingCorridorfunnel PathPostProcessing = 0 // Centers every path position in the middle of the traveled navigation mesh polygon edge. This creates better paths for tile- or gridbased layouts that restrict the movement to the cells center. PathPostprocessingEdgecentered PathPostProcessing = 1 // Applies no postprocessing and returns the raw path corridor as found by the pathfinding algorithm. PathPostprocessingNone PathPostProcessing = 2 )
type PathfindingAlgorithm ¶
type PathfindingAlgorithm int //gd:NavigationPathQueryParameters2D.PathfindingAlgorithm
const ( // The path query uses the default A* pathfinding algorithm. PathfindingAlgorithmAstar PathfindingAlgorithm = 0 )