โ† All examples

godot components

Ledge grab, hang and climb for 2D platformers

Find grabbable ledges with chest and head rays plus a downward ray for the top, hang from the corner, climb up along an up-then-forward path over a set time, or drop with a regrab cooldown.

What this component contains

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

How it works

Class
BaltorLedgeGrab2D, extends Node
Methods
detect(chest_hit: bool, head_hit: bool, falling: bool) -> bool; probe_ledge(space: PhysicsDirectSpaceState2D, origin: Vector2, facing: float, exclude: Array[RID] = [], mask: int = 1) -> Dictionary; try_grab(corner: Vector2, facing: float, falling: bool) -> bool; climb() -> bool; drop() -> bool; advance(delta: float) -> Vector2; get_state() -> State; get_hang_position() -> Vector2; and 1 more
Signals
grabbed, climbed, dropped
Exports
hang_offset, climb_offset, climb_time, regrab_cooldown, chest_height, head_height, reach
Placement
res://baltor/godot_components/ledge_grab_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

Axis-aligned ledges; the corner uses the chest hit x and the top surface y. The owner moves the body to the returned positions and disables its own gravity while hanging or climbing. Verified with Godot 4.7.2 headless; written against the Godot 4.3 API.