โ† All examples

godot components

Room-bounded 2D camera with eased transitions

Keep a 2D camera inside the room that contains the target, center it in rooms smaller than the view, and ease across with smoothstep when the target enters another room.

What this component contains

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

How it works

Class
BaltorRoomCamera2D, extends Node
Methods
add_room(area: Rect2) -> int; room_at(point: Vector2) -> int; clamp_center(center: Vector2, view_size: Vector2, area: Rect2) -> Vector2; update_center(camera_center: Vector2, target: Vector2, view_size: Vector2, delta: float) -> Vector2; get_current_room() -> int; is_transitioning() -> bool
Signals
room_changed
Exports
camera_path, target_path, rooms, transition_time
Placement
res://baltor/godot_components/camera_room_bounds/

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 rectangular rooms only. Overlapping rooms keep the current room until the target leaves it. The view size comes from the viewport and the camera zoom. Verified with Godot 4.7.2 headless; written against the Godot 4.3 API.