extends StaticBody3D @export var index: int = 0 @export var lerp_speed: float = 5.0 @onready var mesh: MeshInstance3D = $MeshInstance3D @onready var audio: AudioStreamPlayer3D = $AudioStreamPlayer3D var _target_occupancy: float = 0.0 var _current_occupancy: float = 0.0 func _ready() -> void: pass # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: _current_occupancy = lerp(_current_occupancy, _target_occupancy, lerp_speed * delta) var material = mesh.get_surface_override_material(0) if material: material.emission_energy_multiplier = _current_occupancy * 10 if audio: audio.volume_db = linear_to_db(_current_occupancy) func _on_proxy_collision_detector_target_occupancy_changed(target_index: int, occupancy: float) -> void: if target_index == index: _target_occupancy = occupancy