jump ani fixing and transition animations

This commit is contained in:
Nicholas Butzke
2026-08-10 12:50:00 -04:00
parent 833e936bcd
commit 0ce626ad42
13 changed files with 359 additions and 35 deletions
+32 -4
View File
@@ -250,7 +250,12 @@ func _apply_color(col: Color) -> void:
func update_state(state: String, speed: float, is_crouching: bool = false) -> void:
var previous_speed := movement_speed
var slowdown := previous_speed - speed
if state in ["ground", "idle"]:
if state == "stop" and current_state != "stop":
_brake_left = BRAKE_DURATION
_brake_strength = clampf(maxf(previous_speed, speed) / 10.0, 0.55, 1.0)
if absf(_locomotion_fwd) > 0.15:
_brake_fwd = signf(_locomotion_fwd)
elif state in ["ground", "idle"]:
if speed > 4.5 and slowdown < 0.05:
_brake_armed = true
if _brake_armed and previous_speed > 4.5 and slowdown > 0.12:
@@ -259,7 +264,7 @@ func update_state(state: String, speed: float, is_crouching: bool = false) -> vo
_brake_armed = false
if absf(_locomotion_fwd) > 0.15:
_brake_fwd = signf(_locomotion_fwd)
elif state not in ["ground", "idle"]:
elif state not in ["ground", "idle", "stop"]:
_brake_left = 0.0
_brake_armed = true
current_state = state
@@ -378,7 +383,7 @@ func _set_shadows_recursive(node: Node) -> void:
func _process(delta: float) -> void:
var brake_target := 0.0
if _brake_left > 0.0 and current_state in ["ground", "idle"]:
if _brake_left > 0.0 and current_state in ["ground", "idle", "stop"]:
_brake_left = maxf(0.0, _brake_left - delta)
var progress := 1.0 - _brake_left / BRAKE_DURATION
var envelope := smoothstep(0.0, 1.0, progress / 0.30) \
@@ -457,6 +462,15 @@ func _process(delta: float) -> void:
t_upper_arm_r_rot.x = -0.5
t_lower_arm_l_rot.x = -1.2
t_lower_arm_r_rot.x = -1.2
"stop":
# Neutral base under the catching-step overlay below. Keeping the run
# cycle out of this state prevents residual speed from accelerating it.
t_root_rot.x = deg_to_rad(8.0)
t_thigh_r_rot.x = deg_to_rad(-24.0)
t_calf_r_rot.x = deg_to_rad(12.0)
t_thigh_l_rot.x = deg_to_rad(8.0)
t_calf_l_rot.x = deg_to_rad(14.0)
"slide":
t_root_pos.y = -0.6
@@ -485,6 +499,20 @@ func _process(delta: float) -> void:
t_upper_arm_r_rot.z = -0.5
t_lower_arm_l_rot.x = -0.5
t_lower_arm_r_rot.x = -0.5
"air_alt":
# Mirror the simple fallback silhouette to match the alternating
# offline-authored variants used by skinned motion-lab characters.
t_thigh_l_rot.x = 0.2
t_thigh_r_rot.x = -0.4
t_calf_l_rot.x = 0.1
t_calf_r_rot.x = 0.5
t_upper_arm_l_rot.x = -0.8
t_upper_arm_r_rot.x = -0.8
t_upper_arm_l_rot.z = -0.5
t_upper_arm_r_rot.z = 0.5
t_lower_arm_l_rot.x = -0.5
t_lower_arm_r_rot.x = -0.5
"wall_run":
t_root_rot.z = deg_to_rad(-15)
@@ -549,7 +577,7 @@ func _process(delta: float) -> void:
# Blend a single catching step over the locomotion result. It rises quickly
# and releases over the same span as the run-to-idle crossfade, preserving
# momentum without freezing the whole mannequin in an exaggerated plant.
if current_state in ["ground", "idle"] and _brake_weight > 0.001:
if current_state in ["ground", "idle", "stop"] and _brake_weight > 0.001:
var travel_sign := -1.0 if _brake_fwd < 0.0 else 1.0
t_root_pos.y = lerpf(t_root_pos.y, -0.025, _brake_weight)
t_root_rot.x = lerp_angle(