Index · Object → RefCounted → NavigationPathQueryParameters2D

NavigationPathQueryParameters2D

Provides parameters for 2D navigation path queries.

Class Description

By changing various properties of this object, such as the start and target position, you can configure path queries to the NavigationServer2D.

Properties

var excluded_regions: RID[] = []

The list of region RIDs that will be excluded from the path query. Use NavigationRegion2D.get_rid() to get the RID 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.

var included_regions: RID[] = []

The list of region RIDs that will be included by the path query. Use NavigationRegion2D.get_rid() to get the RID 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.

var map: RID = RID()

The navigation map RID used in the path query.

var metadata_flags: NavigationPathQueryParameters2D.PathMetadataFlags = 7

Additional information to include with the navigation path.

var navigation_layers: int = 1

The navigation layers the query will use (as a bitmask).

var path_postprocessing: NavigationPathQueryParameters2D.PathPostProcessing = 0

The path postprocessing applied to the raw path corridor found by the pathfinding_algorithm.

var path_return_max_length: float = 0.0

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.

var path_return_max_radius: float = 0.0

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.

var path_search_max_distance: float = 0.0

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.

var path_search_max_polygons: int = 4096

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.

var pathfinding_algorithm: NavigationPathQueryParameters2D.PathfindingAlgorithm = 0

The pathfinding algorithm used in the path query.

var simplify_epsilon: float = 0.0

The path simplification amount in worlds units.

var simplify_path: bool = false

If true a simplified version of the path will be returned with less critical path points removed. The simplification amount is controlled by simplify_epsilon. 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".

var start_position: Vector2 = Vector2(0, 0)

The pathfinding start position in global coordinates.

var target_position: Vector2 = Vector2(0, 0)

The pathfinding target position in global coordinates.

Methods

Inherited from RefCounted (4)
func init_ref() -> bool
func reference() -> bool
func unreference() -> bool
Inherited from Object (62)
func _get(property: StringName) -> Variant
func _get_property_list() -> Dictionary[]
func _init() -> void
func _iter_get(iter: Variant) -> Variant
func _iter_init(iter: Array) -> bool
func _iter_next(iter: Array) -> bool
func _notification(what: int) -> void
func _set(property: StringName, value: Variant) -> bool
func _to_string() -> String
func _validate_property(property: Dictionary) -> void
func add_user_signal(signal: String, arguments: Array = []) -> void
func call(method: StringName) -> Variant
func callv(method: StringName, arg_array: Array) -> Variant
func cancel_free() -> void
func connect(signal: StringName, callable: Callable, flags: int = 0) -> Error
func disconnect(signal: StringName, callable: Callable) -> void
func emit_signal(signal: StringName) -> Error
func free() -> void
func get(property: StringName) -> Variant
func get_class() -> String
func get_incoming_connections() -> Dictionary[]
func get_indexed(property_path: NodePath) -> Variant
func get_meta(name: StringName, default: Variant = null) -> Variant
func get_meta_list() -> StringName[]
func get_method_list() -> Dictionary[]
func get_property_list() -> Dictionary[]
func get_signal_connection_list(signal: StringName) -> Dictionary[]
func get_signal_list() -> Dictionary[]
func has_meta(name: StringName) -> bool
func has_method(method: StringName) -> bool
func has_signal(signal: StringName) -> bool
func is_class(class: StringName) -> bool
func is_connected(signal: StringName, callable: Callable) -> bool
func notification(what: int, reversed: bool = false) -> void
func remove_meta(name: StringName) -> void
func remove_user_signal(signal: StringName) -> void
func set(property: StringName, value: Variant) -> void
func set_block_signals(enable: bool) -> void
func set_deferred(property: StringName, value: Variant) -> void
func set_indexed(property_path: NodePath, value: Variant) -> void
func set_message_translation(enable: bool) -> void
func set_meta(name: StringName, value: Variant) -> void
func set_script(script: Variant) -> void
func set_translation_domain(domain: StringName) -> void
func to_string() -> String
func tr(message: StringName, context: StringName = &"") -> String
func tr_n(message: StringName, plural_message: StringName, n: int, context: StringName = &"") -> String

Signals

Inherited from Object (2)

Enums & Constants

enum PathfindingAlgorithm
PATHFINDING_ALGORITHM_ASTAR = 0

The path query uses the default A* pathfinding algorithm.

enum PathPostProcessing
PATH_POSTPROCESSING_CORRIDORFUNNEL = 0

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.

PATH_POSTPROCESSING_EDGECENTERED = 1

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.

PATH_POSTPROCESSING_NONE = 2

Applies no postprocessing and returns the raw path corridor as found by the pathfinding algorithm.

enum PathMetadataFlags
PATH_METADATA_INCLUDE_NONE = 0

Don't include any additional metadata about the returned path.

PATH_METADATA_INCLUDE_TYPES = 1

Include the type of navigation primitive (region or link) that each point of the path goes through.

PATH_METADATA_INCLUDE_RIDS = 2

Include the RIDs of the regions and links that each point of the path goes through.

PATH_METADATA_INCLUDE_OWNERS = 4

Include the ObjectIDs of the Objects which manage the regions and links each point of the path goes through.

PATH_METADATA_INCLUDE_ALL = 7

Include all available metadata about the returned path.