feat(audio): add wall contact cue

This commit is contained in:
Josh Creek
2026-09-01 23:26:18 +01:00
parent f5fd3bb207
commit 4353abfd97
5 changed files with 29 additions and 1 deletions
+3
View File
@@ -197,6 +197,7 @@ signal thrust_changed(thrust_percent: float)
signal angular_velocity_changed(angular_speed: float)
signal heading_changed(heading_degrees: float)
signal ball_contact(intensity: float, world_position: Vector3)
signal wall_contact(intensity: float)
# Performance optimization - track last emitted values to avoid unnecessary signals
var _last_speed: float = -1.0
@@ -415,6 +416,8 @@ func is_turbo_active() -> bool:
func _on_body_entered(body: Node) -> void:
if body is StaticBody3D:
wall_contact.emit(clampf(linear_velocity.length() / maxf(max_speed, 0.001), 0.0, 1.0))
if not body is Ball:
return
var relative_speed := (linear_velocity - (body as Ball).linear_velocity).length()