Click or drag to resize

AStarGetClosestPositionInSegment Method

Returns the closest position to to_position that resides inside a segment between two connected points.

var astar = AStar.new()
astar.add_point(1, Vector3(0, 0, 0))
astar.add_point(2, Vector3(0, 5, 0))
astar.connect_points(1, 2)
var res = astar.get_closest_position_in_segment(Vector3(3, 3, 0)) # Returns (0, 3, 0)

The result is in the segment that goes from y = 0 to y = 5. It's the closest position in the segment to the given point.

Namespace:  Godot
Assembly:  GodotSharp (in GodotSharp.dll) Version: 1.0.0
Syntax
C#
public Vector3 GetClosestPositionInSegment(
	Vector3 toPosition
)

Parameters

toPosition
Type: GodotVector3

[Missing <param name="toPosition"/> documentation for "M:Godot.AStar.GetClosestPositionInSegment(Godot.Vector3)"]

Return Value

Type: Vector3

[Missing <returns> documentation for "M:Godot.AStar.GetClosestPositionInSegment(Godot.Vector3)"]

See Also