2D follow camera with dead zone and look-ahead
In your harnessGodot componentMIT
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.
ATTRIBUTION.mdLICENSEREADME.mdbaltor_test.gdcamera_follow_deadzone.gdcomponent.jsonexample.tscninspect_gdscript.pyrun_tests.gdtest_package.pytests/test_camera_follow_deadzone.gdverification/native.json
Full files in your harness.
What it takes and gives
- 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/
Limits. 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.
Details
- Kind
- Godot component
- Engine
- Godot 4.3 or later
- Files
- 12 files, 76.3 KB
- Licence
- MIT
- Declared effects
- reads files, runs commands
- Checked with
- Godot 4.7.2, headless
- Checks
- 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
- Techniques
- camera dead zone, velocity look-ahead, exponential smoothing
- Tags
- camera, camera2d, dead zone, look ahead, follow camera, platformer
- Identity
library.supply.creative_originals.f4c661bef4363a5169034ee2.ea1508e9af0ba373- Version
ea1508e9af0ba373003a1ed53c77ff69866c6660468522dbf654919096af4307
The version is the SHA-256 of the item your harness downloads; every file in it names its own checksum.
Something wrong with this item, its rights or its safety? Report it on the support page, or from your harness after a download.