โ† All examples

godot components

2D follow camera with dead zone and look-ahead

Follow a target with a Camera2D that ignores motion inside a dead zone, leads in the direction of travel by up to a set distance and eases toward its goal with exponential smoothing.

What this component contains

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • baltor_test.gd
  • camera_follow_deadzone.gd
  • component.json
  • example.tscn
  • inspect_gdscript.py
  • run_tests.gd
  • test_package.py
  • tests/test_camera_follow_deadzone.gd
  • verification/native.json

How it works

Class
BaltorFollowCamera2D, extends Camera2D
Methods
deadzone_follow(focus: Vector2, target: Vector2, size: Vector2) -> Vector2; update_camera(target_position: Vector2, delta: float) -> void; snap_to(target_position: Vector2) -> void; get_focus() -> Vector2; get_look_ahead() -> Vector2
Exports
target_path, dead_zone, look_ahead_distance, look_ahead_full_speed, look_ahead_speed, follow_speed
Placement
res://baltor/godot_components/camera_follow_deadzone/

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_example_scene
  • godot_readme_usage_compiles

Limits to consider

Velocity comes from frame-to-frame position changes, so teleports produce a look-ahead spike; call snap_to() after teleporting. No room limits (see the room camera) and no shake. Verified with Godot 4.7.2 headless; written against the Godot 4.3 API.