← All examples

godot components

AI perception with view cone, hearing and memory

Decide what a 2D agent sees (range, view cone, peripheral sense, optional occlusion check) and hears (radius times loudness), and remember targets with last known positions until a memory time runs out.

What this component contains

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

How it works

Class
BaltorPerception, extends RefCounted
Methods
can_see(observer: Vector2, facing: Vector2, target: Vector2, occluded: Callable = Callable()) -> bool; can_hear(listener: Vector2, source: Vector2, loudness: float = 1.0) -> bool; observe(delta: float, observer: Vector2, facing: Vector2, targets: Dictionary, occluded: Callable = Callable()) -> void; report_noise(listener: Vector2, source: Vector2, loudness: float = 1.0) -> bool;…
Signals
target_spotted, target_lost, noise_heard
Placement
res://baltor/godot_components/perception_senses/

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

2D only, with the view cone measured from a facing vector. Occlusion is whatever the Callable reports, such as a physics ray; nothing is cast by default. Hearing ignores walls. Target ids are StringNames. Verified with Godot 4.7.2 headless; written against the Godot 4.3 API.