Refactor animation generation: replace create_walk.gd with create_animations.gd

- Removed the old create_walk.gd script, which generated walk animations.
- Introduced create_animations.gd to unify the generation of walk_left, walk_right, and stand_up animations.
- Added a new SpinBox for rest timeout configuration in physics_test_harness.gd.
- Enhanced StickmanRig to support automatic recovery from ragdoll state with configurable timeout.
- Implemented recovery logic in StickmanRig, allowing for smooth transitions from ragdoll to animated state.
- Updated animation generation logic to use new pose templates for standing and lying down positions.
This commit is contained in:
2026-08-27 12:01:54 -04:00
parent e3df1cc5c0
commit 0e971d99b1
12 changed files with 678 additions and 159 deletions
+45
View File
@@ -62,6 +62,9 @@ var _rig: StickmanRig = null
## Top-bar mode toggle button (text flips "Stickman" <-> "Ragdoll").
var _ragdoll_toggle: Button = null
## Rest-timeout spinbox (director-controlled auto-recovery delay).
var _rest_timeout_spinbox: SpinBox = null
# ---------------------------------------------------------------------------
# Lifecycle
# ---------------------------------------------------------------------------
@@ -149,6 +152,36 @@ func _build_ui() -> void:
knock_btn.pressed.connect(_knock_up)
hbox.add_child(knock_btn)
var rest_label := Label.new()
rest_label.text = "Rest"
hbox.add_child(rest_label)
_rest_timeout_spinbox = SpinBox.new()
_rest_timeout_spinbox.min_value = 0.1
_rest_timeout_spinbox.max_value = 10.0
_rest_timeout_spinbox.step = 0.1
_rest_timeout_spinbox.value = 2.0
_rest_timeout_spinbox.value_changed.connect(_on_rest_timeout_changed)
hbox.add_child(_rest_timeout_spinbox)
var recover_btn := Button.new()
recover_btn.text = "Recover Now"
recover_btn.pressed.connect(_recover_now)
hbox.add_child(recover_btn)
if _rig != null:
_rest_timeout_spinbox.value = _rig.rest_timeout
func _on_rest_timeout_changed(v: float) -> void:
if _rig != null:
_rig.rest_timeout = v
func _recover_now() -> void:
if _rig != null:
_rig.request_recovery()
func _on_ragdoll_toggled(pressed: bool) -> void:
if _rig == null:
@@ -223,8 +256,20 @@ func _spawn_rig() -> void:
rig.position = RIG_SPAWN_POSITION
add_child(rig)
_rig = rig
rig.state_changed.connect(_on_rig_state_changed)
_add_rig_collision_proxy()
## Keeps the best-effort collision proxy in sync with the rig's physics mode:
## the ragdoll collides directly with the terrain, so the proxy is removed
## during RAGDOLL and re-added otherwise. Proxy helpers are idempotent.
func _on_rig_state_changed(new_state: int) -> void:
if new_state == StickmanRig.RigState.RAGDOLL:
_remove_rig_collision_proxy()
else:
_add_rig_collision_proxy()
_update_ragdoll_toggle()
# ---------------------------------------------------------------------------
# Dynamic prop spawning (keys 1/2/3)
# ---------------------------------------------------------------------------