โ† All examples

godot components

Path following steering on a polyline corridor

Keep a 2D agent inside a polyline corridor with predictive path following, and query the path: length, closest point, point at a distance and progress along it, for open and closed paths.

What this component contains

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • baltor_test.gd
  • component.json
  • inspect_gdscript.py
  • path_follower_2d.gd
  • run_tests.gd
  • test_package.py
  • tests/test_path_follower_2d.gd
  • verification/native.json

How it works

Class
BaltorPathFollower, extends RefCounted
Methods
set_points(points: PackedVector2Array, closed: bool = false) -> void; get_length() -> float; closest_point(point: Vector2) -> Dictionary; point_at_distance(distance: float) -> Vector2; steer(position: Vector2, velocity: Vector2, max_speed: float, lookahead: float = 0.5, ahead: float = 24.0) -> Vector2; progress_of(point: Vector2) -> float
Placement
res://baltor/godot_components/path_follower_2d/

Recorded checks

godot 4.7.2.stable.official.ed1daf0bf

  • godot_parse_check_only
  • godot_gdscript_tests
  • godot_tests_reject_gutted_component
  • godot_editor_import
  • godot_contract_reflection
  • godot_readme_usage_compiles

Limits to consider

Straight segments only; the closest-point search checks every segment, so very long paths cost more per query. An agent can swing wide of tight corners by about its turning radius. Verified with Godot 4.7.2 headless; written against the Godot 4.3 API.