Browse Source

Comprehensive melee animation overhaul with full-body dynamics

Infantry animations (pose_controller.cpp):
- meleeStrike(): Added 5-phase attack cycle (chamber, anticipation, strike,
  follow-through, recovery) with torso twist, forward lean, shoulder dip,
  and step-forward footwork
- sword_slash(): Complete rewrite with diagonal downward slash trajectory,
  full body rotation, weight shifting, and natural follow-through
- sword_slash_variant(): Updated all variants with directional body dynamics
  for left-to-right and horizontal slash patterns

Cavalry animations (mounted_pose_controller.cpp):
- apply_sword_strike(): Added 5-phase mounted slash with chamber/apex/strike
  sequence, saddle-relative body lean, torso twist, and rein tension
- apply_spear_thrust(): Overhauled couched lance thrust with couch/tension/
  thrust/extend/recover phases, explosive forward body extension

Co-authored-by: djeada <[email protected]>
copilot-swe-agent[bot] 3 days ago
parent
commit
d7788d119d
2 changed files with 462 additions and 151 deletions
  1. 190 44
      render/humanoid/mounted_pose_controller.cpp
  2. 272 107
      render/humanoid/pose_controller.cpp

+ 190 - 44
render/humanoid/mounted_pose_controller.cpp

@@ -380,37 +380,110 @@ void MountedPoseController::apply_sword_strike(
     bool keep_left_hand) {
   attack_phase = std::clamp(attack_phase, 0.0F, 1.0F);
 
-  QVector3D const rest_pos = seatRelative(mount, 0.05F, 0.18F, 0.08F);
-  QVector3D const raised_pos = seatRelative(mount, 0.0F, 0.22F, 0.30F);
-  QVector3D const strike_pos = seatRelative(mount, 0.50F, 0.28F, 0.05F);
+  // Key positions for mounted cavalry slash (typically to the side/down)
+  QVector3D const rest_pos = seatRelative(mount, 0.08F, 0.20F, 0.12F);
+  QVector3D const chamber_pos = seatRelative(mount, -0.05F, 0.25F, 0.40F);
+  QVector3D const apex_pos = seatRelative(mount, -0.02F, 0.30F, 0.48F);
+  QVector3D const strike_pos = seatRelative(mount, 0.45F, 0.35F, 0.0F);
+  QVector3D const followthrough_pos = seatRelative(mount, 0.55F, 0.25F, -0.10F);
 
   QVector3D hand_r_target;
   QVector3D hand_l_target =
       reinAnchor(mount, true, 0.20F, 0.25F) + mount.seat_up * -0.02F;
 
-  if (attack_phase < 0.30F) {
-    float t = attack_phase / 0.30F;
-    t = t * t;
-    hand_r_target = rest_pos * (1.0F - t) + raised_pos * t;
-    update_head_hierarchy(mount, 0.0F, 0.0F, "sword_raise");
-  } else if (attack_phase < 0.50F) {
-    float t = (attack_phase - 0.30F) / 0.20F;
-    t = t * t * t;
-    hand_r_target = raised_pos * (1.0F - t) + strike_pos * t;
+  // Body dynamics for mounted combat
+  float torso_twist = 0.0F;
+  float side_lean = 0.0F;
+  float forward_lean = 0.0F;
+  float shoulder_dip = 0.0F;
+
+  if (attack_phase < 0.18F) {
+    // Phase 1: Chamber - raise weapon overhead, twist body back
+    float t = attack_phase / 0.18F;
+    float ease_t = t * t;
+    hand_r_target = rest_pos * (1.0F - ease_t) + chamber_pos * ease_t;
+
+    torso_twist = -0.04F * ease_t;
+    shoulder_dip = 0.03F * ease_t;
+
+    update_head_hierarchy(mount, 0.0F, 0.0F, "sword_chamber");
+  } else if (attack_phase < 0.28F) {
+    // Phase 2: Apex - brief pause at highest point
+    float t = (attack_phase - 0.18F) / 0.10F;
+    float ease_t = t * t * (3.0F - 2.0F * t);
+    hand_r_target = chamber_pos * (1.0F - ease_t) + apex_pos * ease_t;
+
+    torso_twist = -0.04F;
+    shoulder_dip = 0.03F + 0.02F * ease_t;
+
+    update_head_hierarchy(mount, 0.0F, 0.0F, "sword_apex");
+  } else if (attack_phase < 0.48F) {
+    // Phase 3: Strike - explosive downward/outward slash
+    float t = (attack_phase - 0.28F) / 0.20F;
+    float power_t = t * t * t;
+    hand_r_target = apex_pos * (1.0F - power_t) + strike_pos * power_t;
+
+    // Uncoil body into the strike
+    torso_twist = -0.04F + 0.12F * power_t;
+    side_lean = 0.08F * power_t;     // Lean into strike direction
+    forward_lean = 0.06F * power_t;
+    shoulder_dip = 0.05F - 0.08F * power_t;
+
+    // Tighten reins during strike for stability
+    hand_l_target += mount.seat_up * (-0.03F * power_t);
+
+    update_head_hierarchy(mount, 0.3F * power_t, 0.2F * power_t, "sword_strike");
+  } else if (attack_phase < 0.65F) {
+    // Phase 4: Follow-through
+    float t = (attack_phase - 0.48F) / 0.17F;
+    float ease_t = t * t * (3.0F - 2.0F * t);
+    hand_r_target = strike_pos * (1.0F - ease_t) + followthrough_pos * ease_t;
+
+    torso_twist = 0.08F - 0.02F * t;
+    side_lean = 0.08F - 0.03F * t;
+    forward_lean = 0.06F - 0.02F * t;
+    shoulder_dip = -0.03F;
+
+    update_head_hierarchy(mount, 0.15F, 0.1F, "sword_followthrough");
+  } else {
+    // Phase 5: Recovery - return to guard
+    float t = (attack_phase - 0.65F) / 0.35F;
+    float ease_t = 1.0F - (1.0F - t) * (1.0F - t);
+    hand_r_target = followthrough_pos * (1.0F - ease_t) + rest_pos * ease_t;
 
-    QVector3D const lean = mount.seat_forward * (0.10F * t);
-    m_pose.shoulder_l += lean;
-    m_pose.shoulder_r += lean;
-    m_pose.neck_base += lean * 0.9F;
+    torso_twist = 0.06F * (1.0F - ease_t);
+    side_lean = 0.05F * (1.0F - ease_t);
+    forward_lean = 0.04F * (1.0F - ease_t);
+    shoulder_dip = -0.03F * (1.0F - ease_t);
 
-    update_head_hierarchy(mount, 0.3F * t, 0.0F, "sword_strike");
-  } else {
-    float t = (attack_phase - 0.50F) / 0.50F;
-    t = 1.0F - (1.0F - t) * (1.0F - t);
-    hand_r_target = strike_pos * (1.0F - t) + rest_pos * t;
     update_head_hierarchy(mount, 0.0F, 0.0F, "sword_recover");
   }
 
+  // Apply body dynamics relative to mount orientation
+  if (std::abs(torso_twist) > 0.001F) {
+    QVector3D const twist_offset = mount.seat_forward * torso_twist;
+    m_pose.shoulder_r += twist_offset;
+    m_pose.shoulder_l -= twist_offset * 0.5F;
+  }
+
+  if (side_lean > 0.001F) {
+    QVector3D const lean_offset = mount.seat_right * side_lean;
+    m_pose.shoulder_l += lean_offset;
+    m_pose.shoulder_r += lean_offset;
+    m_pose.neck_base += lean_offset * 0.8F;
+  }
+
+  if (forward_lean > 0.001F) {
+    QVector3D const lean_offset = mount.seat_forward * forward_lean;
+    m_pose.shoulder_l += lean_offset;
+    m_pose.shoulder_r += lean_offset;
+    m_pose.neck_base += lean_offset * 0.9F;
+  }
+
+  if (std::abs(shoulder_dip) > 0.001F) {
+    m_pose.shoulder_r += mount.seat_up * shoulder_dip;
+  }
+
   get_hand(false) = hand_r_target;
   if (!keep_left_hand) {
     get_hand(true) = hand_l_target;
@@ -431,38 +504,111 @@ void MountedPoseController::apply_spear_thrust(
     const MountedAttachmentFrame &mount, float attack_phase) {
   attack_phase = std::clamp(attack_phase, 0.0F, 1.0F);
 
-  QVector3D const guard_pos = seatRelative(mount, 0.10F, 0.15F, 0.10F);
-  QVector3D const thrust_pos = seatRelative(mount, 0.85F, 0.10F, 0.15F);
+  // Key positions for lance/spear thrust from horseback
+  QVector3D const guard_pos = seatRelative(mount, 0.12F, 0.15F, 0.15F);
+  QVector3D const couch_pos = seatRelative(mount, 0.05F, 0.12F, 0.08F);
+  QVector3D const thrust_pos = seatRelative(mount, 0.95F, 0.08F, 0.18F);
+  QVector3D const extended_pos = seatRelative(mount, 1.05F, 0.05F, 0.15F);
 
   QVector3D hand_r_target;
   QVector3D hand_l_target;
 
-  if (attack_phase < 0.25F) {
-    hand_r_target = guard_pos;
-    hand_l_target = guard_pos - mount.seat_right * 0.25F;
-    update_head_hierarchy(mount, 0.0F, 0.0F, "spear_guard_hold");
-  } else if (attack_phase < 0.45F) {
-    float t = (attack_phase - 0.25F) / 0.20F;
-    t = t * t * t;
-    hand_r_target = guard_pos * (1.0F - t) + thrust_pos * t;
-    hand_l_target = (guard_pos - mount.seat_right * 0.25F) * (1.0F - t) +
-                    (thrust_pos - mount.seat_right * 0.30F) * t;
+  // Body dynamics for couched lance thrust
+  float forward_lean = 0.0F;
+  float torso_twist = 0.0F;
+  float shoulder_drop = 0.0F;
+  float torso_compression = 0.0F;
+
+  if (attack_phase < 0.20F) {
+    // Phase 1: Couch the spear - lower and align for thrust
+    float t = attack_phase / 0.20F;
+    float ease_t = t * t;
+    hand_r_target = guard_pos * (1.0F - ease_t) + couch_pos * ease_t;
+    hand_l_target = guard_pos - mount.seat_right * 0.25F +
+                    (couch_pos - guard_pos) * ease_t * 0.6F;
+
+    // Slight crouch for power
+    torso_compression = 0.03F * ease_t;
+    forward_lean = 0.04F * ease_t;
+
+    update_head_hierarchy(mount, 0.1F * ease_t, 0.0F, "spear_couch");
+  } else if (attack_phase < 0.30F) {
+    // Phase 2: Brief tension before thrust
+    hand_r_target = couch_pos;
+    hand_l_target = couch_pos - mount.seat_right * 0.22F;
+
+    torso_compression = 0.03F;
+    forward_lean = 0.04F;
+
+    update_head_hierarchy(mount, 0.1F, 0.0F, "spear_tension");
+  } else if (attack_phase < 0.50F) {
+    // Phase 3: Explosive thrust - extend fully forward
+    float t = (attack_phase - 0.30F) / 0.20F;
+    float power_t = t * t * t;
+    hand_r_target = couch_pos * (1.0F - power_t) + thrust_pos * power_t;
+    hand_l_target = (couch_pos - mount.seat_right * 0.22F) * (1.0F - power_t) +
+                    (thrust_pos - mount.seat_right * 0.28F) * power_t;
+
+    // Explosive body extension
+    forward_lean = 0.04F + 0.16F * power_t;
+    torso_twist = 0.05F * power_t;
+    shoulder_drop = 0.04F * power_t;
+    torso_compression = 0.03F * (1.0F - power_t * 0.5F);
+
+    update_head_hierarchy(mount, 0.5F * power_t, 0.0F, "spear_thrust");
+  } else if (attack_phase < 0.65F) {
+    // Phase 4: Full extension - hold at maximum reach
+    float t = (attack_phase - 0.50F) / 0.15F;
+    float ease_t = t * t * (3.0F - 2.0F * t);
+    hand_r_target = thrust_pos * (1.0F - ease_t) + extended_pos * ease_t;
+    hand_l_target = (thrust_pos - mount.seat_right * 0.28F) * (1.0F - ease_t) +
+                    (extended_pos - mount.seat_right * 0.32F) * ease_t;
+
+    forward_lean = 0.20F;
+    torso_twist = 0.05F;
+    shoulder_drop = 0.04F;
+
+    update_head_hierarchy(mount, 0.5F, 0.0F, "spear_extend");
+  } else {
+    // Phase 5: Recovery - return to guard
+    float t = (attack_phase - 0.65F) / 0.35F;
+    float ease_t = 1.0F - (1.0F - t) * (1.0F - t);
+    hand_r_target = extended_pos * (1.0F - ease_t) + guard_pos * ease_t;
+    hand_l_target = (extended_pos - mount.seat_right * 0.32F) * (1.0F - ease_t) +
+                    (guard_pos - mount.seat_right * 0.25F) * ease_t;
 
-    QVector3D const lean = mount.seat_forward * (0.18F * t);
-    m_pose.shoulder_l += lean;
-    m_pose.shoulder_r += lean;
-    m_pose.neck_base += lean * 0.9F;
+    forward_lean = 0.20F * (1.0F - ease_t);
+    torso_twist = 0.05F * (1.0F - ease_t);
+    shoulder_drop = 0.04F * (1.0F - ease_t);
 
-    update_head_hierarchy(mount, 0.5F * t, 0.0F, "spear_thrust");
-  } else {
-    float t = (attack_phase - 0.45F) / 0.55F;
-    t = 1.0F - (1.0F - t) * (1.0F - t);
-    hand_r_target = thrust_pos * (1.0F - t) + guard_pos * t;
-    hand_l_target = (thrust_pos - mount.seat_right * 0.30F) * (1.0F - t) +
-                    (guard_pos - mount.seat_right * 0.25F) * t;
     update_head_hierarchy(mount, 0.0F, 0.0F, "spear_recover");
   }
 
+  // Apply body dynamics relative to mount orientation
+  if (forward_lean > 0.001F) {
+    QVector3D const lean_offset = mount.seat_forward * forward_lean;
+    m_pose.shoulder_l += lean_offset;
+    m_pose.shoulder_r += lean_offset;
+    m_pose.neck_base += lean_offset * 0.85F;
+  }
+
+  if (std::abs(torso_twist) > 0.001F) {
+    QVector3D const twist_offset = mount.seat_forward * torso_twist;
+    m_pose.shoulder_r += twist_offset;
+    m_pose.shoulder_l -= twist_offset * 0.3F;
+  }
+
+  if (shoulder_drop > 0.001F) {
+    m_pose.shoulder_r -= mount.seat_up * shoulder_drop;
+    m_pose.shoulder_l -= mount.seat_up * (shoulder_drop * 0.3F);
+  }
+
+  if (torso_compression > 0.001F) {
+    m_pose.shoulder_l -= mount.seat_up * torso_compression;
+    m_pose.shoulder_r -= mount.seat_up * torso_compression;
+    m_pose.neck_base -= mount.seat_up * (torso_compression * 0.6F);
+  }
+
   get_hand(false) = hand_r_target;
   get_hand(true) = hand_l_target;
 

+ 272 - 107
render/humanoid/pose_controller.cpp

@@ -250,37 +250,98 @@ void HumanoidPoseController::meleeStrike(float strike_phase) {
 
   strike_phase = std::clamp(strike_phase, 0.0F, 1.0F);
 
-  QVector3D const rest_pos(0.25F, HP::SHOULDER_Y, 0.10F);
-  QVector3D const raised_pos(0.28F, HP::SHOULDER_Y + 0.15F, 0.08F);
-  QVector3D const strike_pos(0.32F, HP::SHOULDER_Y - 0.10F, 0.55F);
+  // Define key positions for a natural horizontal slash toward the target
+  QVector3D const rest_pos(0.22F, HP::SHOULDER_Y + 0.02F, 0.18F);
+  QVector3D const chamber_pos(0.30F, HP::SHOULDER_Y + 0.08F, 0.05F);
+  QVector3D const strike_pos(0.28F, HP::SHOULDER_Y - 0.05F, 0.65F);
+  QVector3D const followthrough_pos(0.10F, HP::SHOULDER_Y - 0.12F, 0.55F);
 
   QVector3D hand_r_target;
   QVector3D hand_l_target;
 
-  if (strike_phase < 0.25F) {
+  // Body dynamics
+  float torso_twist = 0.0F;
+  float forward_lean = 0.0F;
+  float shoulder_dip = 0.0F;
+  float step_forward = 0.0F;
+
+  if (strike_phase < 0.20F) {
+    // Phase 1: Chamber - pull weapon back, twist torso away
+    float t = strike_phase / 0.20F;
+    float ease_t = t * t;
+    hand_r_target = rest_pos * (1.0F - ease_t) + chamber_pos * ease_t;
+    hand_l_target = QVector3D(-0.18F, HP::SHOULDER_Y + 0.02F, 0.22F - 0.08F * t);
+
+    // Twist torso back to coil for the strike
+    torso_twist = -0.04F * ease_t;
+    shoulder_dip = -0.02F * ease_t;
+  } else if (strike_phase < 0.28F) {
+    // Phase 2: Brief anticipation hold
+    hand_r_target = chamber_pos;
+    hand_l_target = QVector3D(-0.18F, HP::SHOULDER_Y + 0.02F, 0.14F);
+    torso_twist = -0.04F;
+    shoulder_dip = -0.02F;
+  } else if (strike_phase < 0.48F) {
+    // Phase 3: Explosive strike - uncoil torso, step forward
+    float t = (strike_phase - 0.28F) / 0.20F;
+    float power_t = t * t * (3.0F - 2.0F * t); // smoothstep for power
+    hand_r_target = chamber_pos * (1.0F - power_t) + strike_pos * power_t;
+    hand_l_target = QVector3D(-0.18F + 0.06F * power_t,
+                              HP::SHOULDER_Y + 0.02F - 0.08F * power_t,
+                              0.14F + 0.20F * power_t);
+
+    // Uncoil torso forward and rotate into strike
+    torso_twist = -0.04F + 0.10F * power_t;
+    forward_lean = 0.08F * power_t;
+    shoulder_dip = -0.02F + 0.05F * power_t;
+    step_forward = 0.06F * power_t;
+  } else if (strike_phase < 0.65F) {
+    // Phase 4: Follow-through - weapon continues past target
+    float t = (strike_phase - 0.48F) / 0.17F;
+    float ease_t = t * t;
+    hand_r_target = strike_pos * (1.0F - ease_t) + followthrough_pos * ease_t;
+    hand_l_target = QVector3D(-0.12F, HP::SHOULDER_Y - 0.06F, 0.34F);
+
+    torso_twist = 0.06F - 0.02F * t;
+    forward_lean = 0.08F - 0.03F * t;
+    shoulder_dip = 0.03F;
+    step_forward = 0.06F;
+  } else {
+    // Phase 5: Recovery - return to guard
+    float t = (strike_phase - 0.65F) / 0.35F;
+    float ease_t = 1.0F - (1.0F - t) * (1.0F - t);
+    hand_r_target = followthrough_pos * (1.0F - ease_t) + rest_pos * ease_t;
+    hand_l_target = QVector3D(-0.12F + (-0.18F + 0.12F) * ease_t,
+                              HP::SHOULDER_Y - 0.06F * (1.0F - ease_t) +
+                                  0.02F * ease_t,
+                              0.34F * (1.0F - ease_t) + 0.22F * ease_t);
+
+    torso_twist = 0.04F * (1.0F - ease_t);
+    forward_lean = 0.05F * (1.0F - ease_t);
+    shoulder_dip = 0.03F * (1.0F - ease_t);
+    step_forward = 0.06F * (1.0F - ease_t);
+  }
 
-    float t = strike_phase / 0.25F;
-    t = t * t;
-    hand_r_target = rest_pos * (1.0F - t) + raised_pos * t;
-    hand_l_target = QVector3D(-0.15F, HP::SHOULDER_Y - 0.1F * t, 0.20F);
-  } else if (strike_phase < 0.35F) {
+  // Apply body dynamics
+  if (std::abs(torso_twist) > 0.001F) {
+    m_pose.shoulder_r.setZ(m_pose.shoulder_r.z() + torso_twist);
+    m_pose.shoulder_l.setZ(m_pose.shoulder_l.z() - torso_twist * 0.5F);
+  }
 
-    hand_r_target = raised_pos;
-    hand_l_target = QVector3D(-0.15F, HP::SHOULDER_Y - 0.1F, 0.20F);
-  } else if (strike_phase < 0.55F) {
+  if (forward_lean > 0.001F) {
+    m_pose.shoulder_l.setZ(m_pose.shoulder_l.z() + forward_lean);
+    m_pose.shoulder_r.setZ(m_pose.shoulder_r.z() + forward_lean);
+    m_pose.neck_base.setZ(m_pose.neck_base.z() + forward_lean * 0.8F);
+    m_pose.head_pos.setZ(m_pose.head_pos.z() + forward_lean * 0.6F);
+  }
 
-    float t = (strike_phase - 0.35F) / 0.2F;
-    t = t * t * t;
-    hand_r_target = raised_pos * (1.0F - t) + strike_pos * t;
-    hand_l_target = QVector3D(-0.15F, HP::SHOULDER_Y - 0.1F * (1.0F - t * 0.5F),
-                              0.20F + 0.15F * t);
-  } else {
+  if (std::abs(shoulder_dip) > 0.001F) {
+    m_pose.shoulder_r.setY(m_pose.shoulder_r.y() + shoulder_dip);
+  }
 
-    float t = (strike_phase - 0.55F) / 0.45F;
-    t = 1.0F - (1.0F - t) * (1.0F - t);
-    hand_r_target = strike_pos * (1.0F - t) + rest_pos * t;
-    hand_l_target = QVector3D(-0.15F, HP::SHOULDER_Y - 0.05F * (1.0F - t),
-                              0.35F * (1.0F - t) + 0.20F * t);
+  if (step_forward > 0.001F) {
+    m_pose.foot_r.setZ(m_pose.foot_r.z() + step_forward);
+    m_pose.knee_r.setZ(m_pose.knee_r.z() + step_forward * 0.5F);
   }
 
   placeHandAt(false, hand_r_target);
@@ -378,57 +439,109 @@ void HumanoidPoseController::sword_slash(float attack_phase) {
 
   attack_phase = std::clamp(attack_phase, 0.0F, 1.0F);
 
+  // Key positions for a diagonal downward slash
   QVector3D const rest_pos(0.20F, HP::SHOULDER_Y + 0.05F, 0.15F);
-  QVector3D const prepare_pos(0.24F, HP::SHOULDER_Y + 0.12F, 0.05F);
-  QVector3D const raised_pos(0.26F, HP::SHOULDER_Y + 0.18F, 0.12F);
-  QVector3D const strike_pos(0.30F, HP::SHOULDER_Y - 0.12F, 0.58F);
+  QVector3D const chamber_pos(0.28F, HP::SHOULDER_Y + 0.20F, 0.02F);
+  QVector3D const apex_pos(0.30F, HP::SHOULDER_Y + 0.25F, 0.08F);
+  QVector3D const strike_pos(0.18F, HP::SHOULDER_Y - 0.15F, 0.62F);
+  QVector3D const followthrough_pos(0.05F, HP::WAIST_Y + 0.10F, 0.50F);
   QVector3D const recover_pos(0.22F, HP::SHOULDER_Y + 0.02F, 0.22F);
 
   QVector3D hand_r_target;
   QVector3D hand_l_target;
 
-  auto easeInOutCubic = [](float t) {
-    return t < 0.5F ? 4.0F * t * t * t
-                    : 1.0F - std::pow(-2.0F * t + 2.0F, 3.0F) / 2.0F;
-  };
-
-  auto smoothstep = [](float edge0, float edge1, float x) {
-    float t = std::clamp((x - edge0) / (edge1 - edge0), 0.0F, 1.0F);
-    return t * t * (3.0F - 2.0F * t);
-  };
-
-  auto lerp = [](float a, float b, float t) { return a * (1.0F - t) + b * t; };
+  // Body dynamics
+  float torso_twist = 0.0F;
+  float forward_lean = 0.0F;
+  float shoulder_rotation = 0.0F;
+  float weight_shift = 0.0F;
+
+  auto smoothstep = [](float t) { return t * t * (3.0F - 2.0F * t); };
+  auto ease_out = [](float t) { return 1.0F - (1.0F - t) * (1.0F - t); };
+  auto ease_in = [](float t) { return t * t; };
+
+  if (attack_phase < 0.15F) {
+    // Phase 1: Prepare - raise weapon to chamber position
+    float t = attack_phase / 0.15F;
+    float ease_t = ease_in(t);
+    hand_r_target = rest_pos * (1.0F - ease_t) + chamber_pos * ease_t;
+    hand_l_target = QVector3D(-0.20F, HP::SHOULDER_Y - 0.02F, 0.15F + 0.02F * t);
+
+    // Rotate shoulders back, coiling for strike
+    torso_twist = -0.05F * ease_t;
+    shoulder_rotation = 0.03F * ease_t;
+  } else if (attack_phase < 0.28F) {
+    // Phase 2: Apex - weapon at highest point, brief tension
+    float t = (attack_phase - 0.15F) / 0.13F;
+    float ease_t = smoothstep(t);
+    hand_r_target = chamber_pos * (1.0F - ease_t) + apex_pos * ease_t;
+    hand_l_target = QVector3D(-0.20F, HP::SHOULDER_Y - 0.04F, 0.17F);
+
+    torso_twist = -0.05F;
+    shoulder_rotation = 0.03F + 0.02F * ease_t;
+    weight_shift = -0.02F * ease_t; // Weight shifts back before strike
+  } else if (attack_phase < 0.48F) {
+    // Phase 3: Strike - explosive diagonal slash downward
+    float t = (attack_phase - 0.28F) / 0.20F;
+    float power_t = t * t * t; // Fast acceleration
+    hand_r_target = apex_pos * (1.0F - power_t) + strike_pos * power_t;
+    hand_l_target =
+        QVector3D(-0.20F + 0.08F * power_t,
+                  HP::SHOULDER_Y - 0.04F - 0.06F * power_t, 0.17F + 0.22F * power_t);
+
+    // Explosive uncoil - torso rotates into strike, body leans forward
+    torso_twist = -0.05F + 0.14F * power_t;
+    forward_lean = 0.10F * power_t;
+    shoulder_rotation = 0.05F - 0.08F * power_t;
+    weight_shift = -0.02F + 0.08F * power_t;
+  } else if (attack_phase < 0.62F) {
+    // Phase 4: Follow-through - weapon continues past target
+    float t = (attack_phase - 0.48F) / 0.14F;
+    float ease_t = smoothstep(t);
+    hand_r_target = strike_pos * (1.0F - ease_t) + followthrough_pos * ease_t;
+    hand_l_target = QVector3D(-0.12F, HP::SHOULDER_Y - 0.10F, 0.39F);
+
+    torso_twist = 0.09F - 0.03F * t;
+    forward_lean = 0.10F - 0.02F * t;
+    weight_shift = 0.06F;
+  } else {
+    // Phase 5: Recovery - return to guard
+    float t = (attack_phase - 0.62F) / 0.38F;
+    float ease_t = ease_out(t);
+    hand_r_target =
+        followthrough_pos * (1.0F - ease_t) + recover_pos * 0.5F * ease_t +
+        rest_pos * 0.5F * ease_t;
+    hand_l_target =
+        QVector3D(-0.12F - 0.08F * ease_t, HP::SHOULDER_Y - 0.10F * (1.0F - ease_t),
+                  0.39F * (1.0F - ease_t) + 0.15F * ease_t);
 
-  if (attack_phase < 0.18F) {
+    torso_twist = 0.06F * (1.0F - ease_t);
+    forward_lean = 0.08F * (1.0F - ease_t);
+    weight_shift = 0.06F * (1.0F - ease_t);
+  }
 
-    float const t = easeInOutCubic(attack_phase / 0.18F);
-    hand_r_target = rest_pos * (1.0F - t) + prepare_pos * t;
-    hand_l_target =
-        QVector3D(-0.21F, HP::SHOULDER_Y - 0.02F - 0.03F * t, 0.15F);
-  } else if (attack_phase < 0.32F) {
+  // Apply body dynamics
+  if (std::abs(torso_twist) > 0.001F) {
+    m_pose.shoulder_r.setZ(m_pose.shoulder_r.z() + torso_twist);
+    m_pose.shoulder_l.setZ(m_pose.shoulder_l.z() - torso_twist * 0.6F);
+  }
 
-    float const t = easeInOutCubic((attack_phase - 0.18F) / 0.14F);
-    hand_r_target = prepare_pos * (1.0F - t) + raised_pos * t;
-    hand_l_target = QVector3D(-0.21F, HP::SHOULDER_Y - 0.05F, 0.17F);
-  } else if (attack_phase < 0.52F) {
+  if (std::abs(shoulder_rotation) > 0.001F) {
+    m_pose.shoulder_r.setY(m_pose.shoulder_r.y() - shoulder_rotation);
+    m_pose.shoulder_l.setY(m_pose.shoulder_l.y() + shoulder_rotation * 0.4F);
+  }
 
-    float t = (attack_phase - 0.32F) / 0.20F;
-    t = t * t * t;
-    hand_r_target = raised_pos * (1.0F - t) + strike_pos * t;
-    hand_l_target = QVector3D(
-        -0.21F, HP::SHOULDER_Y - 0.03F * (1.0F - 0.5F * t), 0.17F + 0.20F * t);
-  } else if (attack_phase < 0.72F) {
-
-    float const t = easeInOutCubic((attack_phase - 0.52F) / 0.20F);
-    hand_r_target = strike_pos * (1.0F - t) + recover_pos * t;
-    hand_l_target = QVector3D(-0.20F, HP::SHOULDER_Y - 0.015F * (1.0F - t),
-                              lerp(0.37F, 0.20F, t));
-  } else {
+  if (forward_lean > 0.001F) {
+    m_pose.shoulder_l.setZ(m_pose.shoulder_l.z() + forward_lean);
+    m_pose.shoulder_r.setZ(m_pose.shoulder_r.z() + forward_lean);
+    m_pose.neck_base.setZ(m_pose.neck_base.z() + forward_lean * 0.7F);
+    m_pose.head_pos.setZ(m_pose.head_pos.z() + forward_lean * 0.5F);
+    m_pose.pelvis_pos.setZ(m_pose.pelvis_pos.z() + forward_lean * 0.3F);
+  }
 
-    float const t = smoothstep(0.72F, 1.0F, attack_phase);
-    hand_r_target = recover_pos * (1.0F - t) + rest_pos * t;
-    hand_l_target = QVector3D(-0.20F - 0.02F * (1.0F - t), HP::SHOULDER_Y,
-                              lerp(0.20F, 0.15F, t));
+  if (std::abs(weight_shift) > 0.001F) {
+    m_pose.foot_r.setZ(m_pose.foot_r.z() + weight_shift);
+    m_pose.knee_r.setZ(m_pose.knee_r.z() + weight_shift * 0.6F);
   }
 
   placeHandAt(false, hand_r_target);
@@ -500,22 +613,30 @@ void HumanoidPoseController::sword_slash_variant(float attack_phase,
 
   attack_phase = std::clamp(attack_phase, 0.0F, 1.0F);
 
+  // Base positions - will be modified by variant
   QVector3D rest_pos(0.20F, HP::SHOULDER_Y + 0.05F, 0.15F);
-  QVector3D prepare_pos(0.24F, HP::SHOULDER_Y + 0.12F, 0.05F);
-  QVector3D raised_pos(0.26F, HP::SHOULDER_Y + 0.18F, 0.12F);
-  QVector3D strike_pos(0.30F, HP::SHOULDER_Y - 0.12F, 0.58F);
-  QVector3D recover_pos(0.22F, HP::SHOULDER_Y + 0.02F, 0.22F);
+  QVector3D chamber_pos(0.28F, HP::SHOULDER_Y + 0.20F, 0.02F);
+  QVector3D apex_pos(0.30F, HP::SHOULDER_Y + 0.25F, 0.08F);
+  QVector3D strike_pos(0.18F, HP::SHOULDER_Y - 0.15F, 0.62F);
+  QVector3D followthrough_pos(0.05F, HP::WAIST_Y + 0.10F, 0.50F);
 
+  // Variant-specific attack patterns
+  float strike_direction = 1.0F; // 1.0 = right-to-left, -1.0 = left-to-right
   switch (variant % 3) {
   case 1:
-    prepare_pos = QVector3D(-0.08F, HP::SHOULDER_Y + 0.15F, 0.06F);
-    raised_pos = QVector3D(-0.06F, HP::SHOULDER_Y + 0.20F, 0.10F);
-    strike_pos = QVector3D(0.35F, HP::SHOULDER_Y - 0.10F, 0.55F);
+    // Left-to-right diagonal slash
+    chamber_pos = QVector3D(-0.10F, HP::SHOULDER_Y + 0.22F, 0.04F);
+    apex_pos = QVector3D(-0.08F, HP::SHOULDER_Y + 0.28F, 0.10F);
+    strike_pos = QVector3D(0.32F, HP::SHOULDER_Y - 0.12F, 0.58F);
+    followthrough_pos = QVector3D(0.40F, HP::WAIST_Y + 0.08F, 0.48F);
+    strike_direction = -1.0F;
     break;
   case 2:
-    prepare_pos = QVector3D(0.32F, HP::SHOULDER_Y + 0.10F, 0.02F);
-    raised_pos = QVector3D(0.35F, HP::SHOULDER_Y + 0.08F, 0.08F);
-    strike_pos = QVector3D(0.18F, HP::SHOULDER_Y - 0.08F, 0.60F);
+    // Horizontal slash from right
+    chamber_pos = QVector3D(0.35F, HP::SHOULDER_Y + 0.10F, 0.0F);
+    apex_pos = QVector3D(0.38F, HP::SHOULDER_Y + 0.08F, 0.06F);
+    strike_pos = QVector3D(0.05F, HP::SHOULDER_Y - 0.05F, 0.65F);
+    followthrough_pos = QVector3D(-0.10F, HP::SHOULDER_Y - 0.10F, 0.55F);
     break;
   default:
     break;
@@ -524,43 +645,87 @@ void HumanoidPoseController::sword_slash_variant(float attack_phase,
   QVector3D hand_r_target;
   QVector3D hand_l_target;
 
-  auto easeInOutCubic = [](float t) {
-    return t < 0.5F ? 4.0F * t * t * t
-                    : 1.0F - std::pow(-2.0F * t + 2.0F, 3.0F) / 2.0F;
-  };
+  // Body dynamics
+  float torso_twist = 0.0F;
+  float forward_lean = 0.0F;
+  float shoulder_rotation = 0.0F;
+  float weight_shift = 0.0F;
+
+  auto smoothstep = [](float t) { return t * t * (3.0F - 2.0F * t); };
+  auto ease_out = [](float t) { return 1.0F - (1.0F - t) * (1.0F - t); };
+
+  if (attack_phase < 0.15F) {
+    float t = attack_phase / 0.15F;
+    float ease_t = t * t;
+    hand_r_target = rest_pos * (1.0F - ease_t) + chamber_pos * ease_t;
+    hand_l_target = QVector3D(-0.20F, HP::SHOULDER_Y - 0.02F, 0.15F);
+
+    torso_twist = -0.05F * strike_direction * ease_t;
+    shoulder_rotation = 0.03F * ease_t;
+  } else if (attack_phase < 0.28F) {
+    float t = (attack_phase - 0.15F) / 0.13F;
+    float ease_t = smoothstep(t);
+    hand_r_target = chamber_pos * (1.0F - ease_t) + apex_pos * ease_t;
+    hand_l_target = QVector3D(-0.20F, HP::SHOULDER_Y - 0.04F, 0.17F);
+
+    torso_twist = -0.05F * strike_direction;
+    shoulder_rotation = 0.03F + 0.02F * ease_t;
+    weight_shift = -0.02F * ease_t;
+  } else if (attack_phase < 0.48F) {
+    float t = (attack_phase - 0.28F) / 0.20F;
+    float power_t = t * t * t;
+    hand_r_target = apex_pos * (1.0F - power_t) + strike_pos * power_t;
+    hand_l_target =
+        QVector3D(-0.20F + 0.08F * power_t,
+                  HP::SHOULDER_Y - 0.04F - 0.06F * power_t, 0.17F + 0.22F * power_t);
+
+    torso_twist = -0.05F * strike_direction + 0.14F * strike_direction * power_t;
+    forward_lean = 0.10F * power_t;
+    shoulder_rotation = 0.05F - 0.08F * power_t;
+    weight_shift = -0.02F + 0.08F * power_t;
+  } else if (attack_phase < 0.62F) {
+    float t = (attack_phase - 0.48F) / 0.14F;
+    float ease_t = smoothstep(t);
+    hand_r_target = strike_pos * (1.0F - ease_t) + followthrough_pos * ease_t;
+    hand_l_target = QVector3D(-0.12F, HP::SHOULDER_Y - 0.10F, 0.39F);
+
+    torso_twist = 0.09F * strike_direction - 0.03F * strike_direction * t;
+    forward_lean = 0.10F - 0.02F * t;
+    weight_shift = 0.06F;
+  } else {
+    float t = (attack_phase - 0.62F) / 0.38F;
+    float ease_t = ease_out(t);
+    hand_r_target = followthrough_pos * (1.0F - ease_t) + rest_pos * ease_t;
+    hand_l_target =
+        QVector3D(-0.12F - 0.08F * ease_t, HP::SHOULDER_Y - 0.10F * (1.0F - ease_t),
+                  0.39F * (1.0F - ease_t) + 0.15F * ease_t);
 
-  auto smoothstep = [](float edge0, float edge1, float x) {
-    float t = std::clamp((x - edge0) / (edge1 - edge0), 0.0F, 1.0F);
-    return t * t * (3.0F - 2.0F * t);
-  };
+    torso_twist = 0.06F * strike_direction * (1.0F - ease_t);
+    forward_lean = 0.08F * (1.0F - ease_t);
+    weight_shift = 0.06F * (1.0F - ease_t);
+  }
 
-  auto lerp = [](float a, float b, float t) { return a * (1.0F - t) + b * t; };
+  // Apply body dynamics
+  if (std::abs(torso_twist) > 0.001F) {
+    m_pose.shoulder_r.setZ(m_pose.shoulder_r.z() + torso_twist);
+    m_pose.shoulder_l.setZ(m_pose.shoulder_l.z() - torso_twist * 0.6F);
+  }
 
-  if (attack_phase < 0.18F) {
-    float const t = easeInOutCubic(attack_phase / 0.18F);
-    hand_r_target = rest_pos * (1.0F - t) + prepare_pos * t;
-    hand_l_target =
-        QVector3D(-0.21F, HP::SHOULDER_Y - 0.02F - 0.03F * t, 0.15F);
-  } else if (attack_phase < 0.32F) {
-    float const t = easeInOutCubic((attack_phase - 0.18F) / 0.14F);
-    hand_r_target = prepare_pos * (1.0F - t) + raised_pos * t;
-    hand_l_target = QVector3D(-0.21F, HP::SHOULDER_Y - 0.05F, 0.17F);
-  } else if (attack_phase < 0.52F) {
-    float t = (attack_phase - 0.32F) / 0.20F;
-    t = t * t * t;
-    hand_r_target = raised_pos * (1.0F - t) + strike_pos * t;
-    hand_l_target = QVector3D(
-        -0.21F, HP::SHOULDER_Y - 0.03F * (1.0F - 0.5F * t), 0.17F + 0.20F * t);
-  } else if (attack_phase < 0.72F) {
-    float const t = easeInOutCubic((attack_phase - 0.52F) / 0.20F);
-    hand_r_target = strike_pos * (1.0F - t) + recover_pos * t;
-    hand_l_target = QVector3D(-0.20F, HP::SHOULDER_Y - 0.015F * (1.0F - t),
-                              lerp(0.37F, 0.20F, t));
-  } else {
-    float const t = smoothstep(0.72F, 1.0F, attack_phase);
-    hand_r_target = recover_pos * (1.0F - t) + rest_pos * t;
-    hand_l_target = QVector3D(-0.20F - 0.02F * (1.0F - t), HP::SHOULDER_Y,
-                              lerp(0.20F, 0.15F, t));
+  if (std::abs(shoulder_rotation) > 0.001F) {
+    m_pose.shoulder_r.setY(m_pose.shoulder_r.y() - shoulder_rotation);
+    m_pose.shoulder_l.setY(m_pose.shoulder_l.y() + shoulder_rotation * 0.4F);
+  }
+
+  if (forward_lean > 0.001F) {
+    m_pose.shoulder_l.setZ(m_pose.shoulder_l.z() + forward_lean);
+    m_pose.shoulder_r.setZ(m_pose.shoulder_r.z() + forward_lean);
+    m_pose.neck_base.setZ(m_pose.neck_base.z() + forward_lean * 0.7F);
+    m_pose.head_pos.setZ(m_pose.head_pos.z() + forward_lean * 0.5F);
+  }
+
+  if (std::abs(weight_shift) > 0.001F) {
+    m_pose.foot_r.setZ(m_pose.foot_r.z() + weight_shift);
+    m_pose.knee_r.setZ(m_pose.knee_r.z() + weight_shift * 0.6F);
   }
 
   placeHandAt(false, hand_r_target);