feat(goals): add cinematic celebration sequence

This commit is contained in:
Josh Creek
2026-08-07 22:45:33 +01:00
parent 28eb45338a
commit 8bd65290fc
7 changed files with 190 additions and 12 deletions
+29
View File
@@ -48,6 +48,9 @@ var _shake_strength := 0.0
var _shake_noise := FastNoiseLite.new()
var _shake_time := 0.0
var _last_shake_offset := Vector3.ZERO
var _goal_cut_active := false
var _goal_cut_position := Vector3.ZERO
var _goal_cut_look_at := Vector3.ZERO
func _ready():
@@ -86,6 +89,9 @@ func _physics_process(delta):
_last_shake_offset = Vector3.ZERO
if not is_instance_valid(target):
return
if _goal_cut_active:
_smooth_look_at(_goal_cut_look_at, delta)
return
_update_speed_feel(delta)
var ball := _get_ball()
if ball_cam_enabled and ball:
@@ -199,3 +205,26 @@ func _apply_shake(delta: float) -> void:
_last_shake_offset = camera.global_basis.x * noise.x + camera.global_basis.y * noise.y
camera.global_position += _last_shake_offset
_shake_strength = move_toward(_shake_strength, 0.0, shake_decay * delta)
func begin_goal_cut(goal_position: Vector3) -> void:
_goal_cut_active = true
# The hard cut replaces the chase camera's presentation offset entirely;
# don't let the next physics frame subtract a pre-cut shake sample from the
# new cinematic position.
camera.global_position -= _last_shake_offset
_last_shake_offset = Vector3.ZERO
var inward := Vector3(-goal_position.x, 0.0, -goal_position.z)
if inward.length_squared() < 0.01:
inward = Vector3.BACK
else:
inward = inward.normalized()
_goal_cut_position = goal_position + inward * 10.5 + Vector3.UP * 5.5
_goal_cut_look_at = goal_position + Vector3.UP * 0.8
camera.global_position = _goal_cut_position
camera.fov = 58.0
camera.look_at(_goal_cut_look_at, Vector3.UP)
func end_goal_cut() -> void:
_goal_cut_active = false