All files / types skeletal.ts

100% Statements 85/85
100% Branches 4/4
100% Functions 4/4
100% Lines 83/83

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764                                                                                                                                                                                                                                                                                                                          86x   86x 86x 86x     86x 86x 86x     86x 86x     86x 86x     86x 86x                                                                                                                                                                                                                                                                                                                                                                                                                                             86x   86x     86x 86x 86x     86x 86x     86x 86x 86x 86x 86x 86x     86x 86x 86x 86x 86x 86x     86x 86x 86x 86x 86x     86x 86x 86x 86x 86x     86x 86x 86x 86x 86x 86x 86x 86x 86x 86x 86x 86x 86x 86x 86x 86x 86x 86x 86x     86x 86x 86x 86x 86x 86x 86x 86x 86x 86x 86x 86x 86x 86x 86x 86x 86x 86x 86x                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       32x 448x             32x                                                                      
/**
 * Skeletal rigging types for articulated body model
 * 
 * Defines bone hierarchy, skeletal rig structure, and animation keyframes
 * for realistic human-like fighter animations with independent limb movement.
 * 
 * @module types/skeletal
 * @category Type Definitions
 * @korean 골격타입
 */
 
import * as THREE from "three";
 
/**
 * Bone in skeletal rig hierarchy
 * 
 * Represents a single bone with position, rotation, scale, and parent-child relationships.
 * Bones form a tree structure for realistic articulated body movement.
 * 
 * @public
 * @category Skeletal System
 * @korean 뼈
 */
export interface Bone {
  /**
   * Unique identifier for the bone
   * @korean 이름
   */
  readonly name: string;
 
  /**
   * Parent bone (null for root bone)
   * @korean 부모뼈
   */
  parent: Bone | null;
 
  /**
   * Local position relative to parent
   * @korean 위치
   */
  position: THREE.Vector3;
 
  /**
   * Local rotation in Euler angles
   * @korean 회전
   */
  rotation: THREE.Euler;
 
  /**
   * Local scale
   * @korean 크기
   */
  scale: THREE.Vector3;
 
  /**
   * Child bones
   * @korean 자식뼈들
   */
  children: Bone[];
 
  /**
   * Length of the bone (for rendering)
   * @korean 길이
   */
  readonly length: number;
 
  /**
   * Rest pose position (default pose)
   * @korean 기본위치
   */
  readonly restPosition: THREE.Vector3;
 
  /**
   * Rest pose rotation (default pose)
   * @korean 기본회전
   */
  readonly restRotation: THREE.Euler;
}
 
/**
 * Skeletal rig with complete bone hierarchy
 * 
 * Contains root bone and map of all bones for efficient lookup.
 * Maximum 30 bones for 60fps performance.
 * 
 * @public
 * @category Skeletal System
 * @korean 골격
 */
export interface SkeletalRig {
  /**
   * Root bone (pelvis/center)
   * @korean 뿌리뼈
   */
  readonly root: Bone;
 
  /**
   * Map of bone name to bone for fast lookup
   * @korean 뼈맵
   */
  readonly bones: Map<string, Bone>;
 
  /**
   * Total number of bones in rig
   * @korean 뼈개수
   */
  readonly boneCount: number;
}
 
/**
 * Animation keyframe for skeletal animation
 * 
 * Defines bone transformations at a specific time in the animation.
 * Keyframes are interpolated for smooth animation between poses.
 * 
 * @public
 * @category Animation
 * @korean 애니메이션키프레임
 */
export interface AnimationKeyframe {
  /**
   * Time in seconds from animation start
   * @korean 시간
   */
  readonly time: number;
 
  /**
   * Bone rotations at this keyframe
   * Map of bone name to rotation
   * @korean 뼈회전들
   */
  readonly boneRotations: Map<string, THREE.Euler>;
 
  /**
   * Bone positions at this keyframe (optional, for IK or special moves)
   * Map of bone name to position offset from rest pose
   * @korean 뼈위치들
   */
  readonly bonePositions: Map<string, THREE.Vector3>;
 
  /**
   * Optional easing function name for interpolation
   * @korean 이징함수
   */
  readonly easing?: "linear" | "ease-in" | "ease-out" | "ease-in-out";
}
 
/**
 * Attack animation type categories
 * 
 * Defines the 5 base categories of attack animations with variants.
 * Each technique maps to one of these animation types.
 * 
 * @public
 * @category Animation
 * @korean 공격애니메이션타입
 */
export enum AttackAnimationType {
  // Punch category (주먹 타격)
  PUNCH_HIGH = "punch_high",
  PUNCH_MID = "punch_mid",
  PUNCH_LOW = "punch_low",
 
  // Kick category (발차기)
  KICK_FRONT = "kick_front",
  KICK_SIDE = "kick_side",
  KICK_ROUNDHOUSE = "kick_round",
 
  // Elbow category (팔꿈치 타격)
  ELBOW_STRIKE = "elbow_strike",
  ELBOW_UPPERCUT = "elbow_uppercut",
 
  // Knee category (무릎 타격)
  KNEE_STRIKE = "knee_strike",
  KNEE_CLINCH = "knee_clinch",
 
  // Pressure point category (급소 타격)
  PRESSURE_POINT = "pressure_point",
  PRESSURE_POINT_RAPID = "pressure_point_rapid",
}
 
/**
 * Animation configuration for a technique
 * 
 * Links a technique to its specific attack animation with speed modifier.
 * 
 * @public
 * @category Animation
 * @korean 기술애니메이션설정
 */
export interface TechniqueAnimationConfig {
  /**
   * Type of attack animation to play
   * @korean 애니메이션타입
   */
  readonly type: AttackAnimationType;
 
  /**
   * Speed modifier (0.8-1.2)
   * - Light techniques: 1.2x speed
   * - Normal techniques: 1.0x speed
   * - Heavy techniques: 0.8x speed
   * @korean 속도배율
   */
  readonly speedModifier: number;
}
 
/**
 * Complete skeletal animation sequence
 * 
 * Sequence of keyframes defining a complete animation
 * (e.g., jab, cross, roundhouse kick).
 * 
 * @public
 * @category Animation
 * @korean 골격애니메이션
 */
export interface SkeletalAnimation {
  /**
   * Animation identifier
   * @korean 이름
   */
  readonly name: string;
 
  /**
   * Korean name for animation
   * @korean 한글이름
   */
  readonly koreanName: string;
 
  /**
   * Animation keyframes in chronological order
   * @korean 키프레임들
   */
  readonly keyframes: AnimationKeyframe[];
 
  /**
   * Total duration in seconds
   * @korean 지속시간
   */
  readonly duration: number;
 
  /**
   * Whether animation loops
   * @korean 반복여부
   */
  readonly loop: boolean;
 
  /**
   * Animation type (attack, defense, stance change, movement, etc.)
   * @korean 애니메이션타입
   */
  readonly type: "attack" | "defense" | "stance" | "walk" | "idle" | "movement";
}
 
/**
 * Bone chain definition for IK (Inverse Kinematics)
 * 
 * Defines a chain of bones for IK solving (e.g., arm chain, leg chain).
 * Used for realistic limb positioning and movement.
 * 
 * @public
 * @category Skeletal System
 * @korean 뼈체인
 */
export interface BoneChain {
  /**
   * Chain identifier
   * @korean 이름
   */
  readonly name: string;
 
  /**
   * Start bone (e.g., shoulder for arm chain)
   * @korean 시작뼈
   */
  readonly startBone: string;
 
  /**
   * End bone (e.g., hand for arm chain)
   * @korean 끝뼈
   */
  readonly endBone: string;
 
  /**
   * Bones in chain from start to end
   * @korean 뼈들
   */
  readonly bones: string[];
 
  /**
   * IK target position (for end effector)
   * @korean IK목표
   */
  ikTarget?: THREE.Vector3;
}
 
/**
 * Hand bone structure with 5 fingers
 * 
 * Simplified hand model with palm and 5 fingers.
 * Each finger has 3 segments (proximal, middle, distal).
 * 
 * @public
 * @category Skeletal System
 * @korean 손뼈
 */
export interface HandBones {
  /**
   * Palm bone
   * @korean 손바닥
   */
  readonly palm: Bone;
 
  /**
   * Thumb bones (3 segments)
   * @korean 엄지손가락
   */
  readonly thumb: [Bone, Bone, Bone];
 
  /**
   * Index finger bones (3 segments)
   * @korean 검지손가락
   */
  readonly index: [Bone, Bone, Bone];
 
  /**
   * Middle finger bones (3 segments)
   * @korean 중지손가락
   */
  readonly middle: [Bone, Bone, Bone];
 
  /**
   * Ring finger bones (3 segments)
   * @korean 약지손가락
   */
  readonly ring: [Bone, Bone, Bone];
 
  /**
   * Pinky finger bones (3 segments)
   * @korean 새끼손가락
   */
  readonly pinky: [Bone, Bone, Bone];
}
 
/**
 * Joint constraint for realistic movement
 * 
 * Defines rotation limits for joints (e.g., elbow can't bend backward).
 * Ensures anatomically correct movement.
 * 
 * @public
 * @category Skeletal System
 * @korean 관절제약
 */
export interface JointConstraint {
  /**
   * Bone name this constraint applies to
   * @korean 뼈이름
   */
  readonly boneName: string;
 
  /**
   * Minimum rotation angles (X, Y, Z) in radians
   * @korean 최소회전
   */
  readonly minRotation: THREE.Vector3;
 
  /**
   * Maximum rotation angles (X, Y, Z) in radians
   * @korean 최대회전
   */
  readonly maxRotation: THREE.Vector3;
 
  /**
   * Whether this joint can twist (rotate around its length)
   * @korean 비틀기가능
   */
  readonly canTwist: boolean;
}
 
/**
 * Bone names for humanoid rig
 * 
 * Standard bone naming convention for humanoid skeleton.
 * Total: 28 bones base + optional 38 hand bones (19 per hand) = 66 bones max.
 * 
 * Hand bones are optional and can be excluded for performance (LOD system).
 * 
 * @public
 * @category Skeletal System
 * @korean 뼈이름들
 */
export enum BoneName {
  // Core (1 bone)
  PELVIS = "pelvis",
 
  // Spine (3 bones)
  SPINE_LOWER = "spine_lower",
  SPINE_MIDDLE = "spine_middle",
  SPINE_UPPER = "spine_upper",
 
  // Head (2 bones)
  NECK = "neck",
  HEAD = "head",
 
  // Left Arm (6 bones)
  SHOULDER_L = "shoulder_L",
  UPPER_ARM_L = "upper_arm_L",
  ELBOW_L = "elbow_L",
  FOREARM_L = "forearm_L",
  WRIST_L = "wrist_L",
  HAND_L = "hand_L",
 
  // Right Arm (6 bones)
  SHOULDER_R = "shoulder_R",
  UPPER_ARM_R = "upper_arm_R",
  ELBOW_R = "elbow_R",
  FOREARM_R = "forearm_R",
  WRIST_R = "wrist_R",
  HAND_R = "hand_R",
 
  // Left Leg (5 bones)
  HIP_L = "hip_L",
  THIGH_L = "thigh_L",
  KNEE_L = "knee_L",
  SHIN_L = "shin_L",
  FOOT_L = "foot_L",
 
  // Right Leg (5 bones)
  HIP_R = "hip_R",
  THIGH_R = "thigh_R",
  KNEE_R = "knee_R",
  SHIN_R = "shin_R",
  FOOT_R = "foot_R",
 
  // Left Hand Fingers (19 bones - optional for LOD)
  THUMB_META_L = "thumb_meta_L",
  THUMB_PROX_L = "thumb_prox_L",
  THUMB_DIST_L = "thumb_dist_L",
  INDEX_META_L = "index_meta_L",
  INDEX_PROX_L = "index_prox_L",
  INDEX_INTER_L = "index_inter_L",
  INDEX_DIST_L = "index_dist_L",
  MIDDLE_META_L = "middle_meta_L",
  MIDDLE_PROX_L = "middle_prox_L",
  MIDDLE_INTER_L = "middle_inter_L",
  MIDDLE_DIST_L = "middle_dist_L",
  RING_META_L = "ring_meta_L",
  RING_PROX_L = "ring_prox_L",
  RING_INTER_L = "ring_inter_L",
  RING_DIST_L = "ring_dist_L",
  PINKY_META_L = "pinky_meta_L",
  PINKY_PROX_L = "pinky_prox_L",
  PINKY_INTER_L = "pinky_inter_L",
  PINKY_DIST_L = "pinky_dist_L",
 
  // Right Hand Fingers (19 bones - optional for LOD)
  THUMB_META_R = "thumb_meta_R",
  THUMB_PROX_R = "thumb_prox_R",
  THUMB_DIST_R = "thumb_dist_R",
  INDEX_META_R = "index_meta_R",
  INDEX_PROX_R = "index_prox_R",
  INDEX_INTER_R = "index_inter_R",
  INDEX_DIST_R = "index_dist_R",
  MIDDLE_META_R = "middle_meta_R",
  MIDDLE_PROX_R = "middle_prox_R",
  MIDDLE_INTER_R = "middle_inter_R",
  MIDDLE_DIST_R = "middle_dist_R",
  RING_META_R = "ring_meta_R",
  RING_PROX_R = "ring_prox_R",
  RING_INTER_R = "ring_inter_R",
  RING_DIST_R = "ring_dist_R",
  PINKY_META_R = "pinky_meta_R",
  PINKY_PROX_R = "pinky_prox_R",
  PINKY_INTER_R = "pinky_inter_R",
  PINKY_DIST_R = "pinky_dist_R",
}
 
/**
 * Animation state for skeletal player
 * 
 * Tracks current animation playback state for skeletal animations.
 * 
 * @public
 * @category Animation
 * @korean 애니메이션상태
 */
export interface SkeletalAnimationState {
  /**
   * Current animation being played
   * @korean 현재애니메이션
   */
  currentAnimation: SkeletalAnimation | null;
 
  /**
   * Current time in animation (seconds)
   * @korean 현재시간
   */
  currentTime: number;
 
  /**
   * Whether animation is playing
   * @korean 재생중
   */
  isPlaying: boolean;
 
  /**
   * Animation playback speed multiplier
   * @korean 재생속도
   */
  playbackSpeed: number;
 
  /**
   * Previous keyframe index
   * @korean 이전키프레임
   */
  previousKeyframeIndex: number;
 
  /**
   * Next keyframe index
   * @korean 다음키프레임
   */
  nextKeyframeIndex: number;
}
 
/**
 * Fighting stance guard pose configuration
 * 
 * Defines complete body positioning for authentic Korean martial arts stances.
 * Includes arms, torso, legs, and pelvis rotations based on traditional Taekwondo/Hapkido.
 * 
 * Each stance corresponds to a real martial arts position with unique leg positioning.
 * Used for stance-specific idle animations at 60fps.
 * 
 * @public
 * @category Animation
 * @korean 자세방어포즈
 */
export interface StanceGuardPose {
  /**
   * Left arm bone rotations (shoulder, elbow, wrist)
   * @korean 왼팔
   */
  readonly leftArm: {
    readonly shoulder: THREE.Euler;
    readonly elbow: THREE.Euler;
    readonly wrist: THREE.Euler;
  };
 
  /**
   * Right arm bone rotations (shoulder, elbow, wrist)
   * @korean 오른팔
   */
  readonly rightArm: {
    readonly shoulder: THREE.Euler;
    readonly elbow: THREE.Euler;
    readonly wrist: THREE.Euler;
  };
 
  /**
   * Torso rotation (spine upper bone)
   * @korean 몸통회전
   */
  readonly torso: THREE.Euler;
 
  /**
   * Left leg bone rotations (hip, knee, ankle)
   * NEW: For authentic Taekwondo stance positioning
   * @korean 왼다리
   */
  readonly leftLeg: {
    readonly hip: THREE.Euler;      // Hip rotation/abduction
    readonly knee: THREE.Euler;     // Knee bend angle
    readonly ankle: THREE.Euler;    // Ankle dorsiflexion/plantarflexion
  };
 
  /**
   * Right leg bone rotations (hip, knee, ankle)
   * NEW: For authentic Taekwondo stance positioning
   * @korean 오른다리
   */
  readonly rightLeg: {
    readonly hip: THREE.Euler;      // Hip rotation/abduction
    readonly knee: THREE.Euler;     // Knee bend angle
    readonly ankle: THREE.Euler;    // Ankle dorsiflexion/plantarflexion
  };
 
  /**
   * Pelvis rotation (hip tilt and rotation)
   * NEW: For proper stance base
   * @korean 골반회전
   */
  readonly pelvis: THREE.Euler;
 
  /**
   * Stance width (foot spacing in meters)
   * NEW: Defines lateral distance between feet
   * Range: 0.3 (narrow) to 1.5 (wide horse stance)
   *
   * This value describes the intended lateral spacing between the feet for this
   * stance configuration. Consumers (e.g. animation systems or positioning
   * overlays) may use it to drive foot placement, validation, or visualization
   * as needed.
   *
   * @korean 자세너비
   */
  readonly stanceWidth: number;
 
  /**
   * Weight distribution (forward/neutral/back)
   * @korean 무게중심
   */
  readonly weight: "forward" | "neutral" | "back";
 
  /**
   * Breathing animation range (min/max for chest movement)
   * @korean 호흡범위
   */
  readonly breathingRange: {
    readonly min: number;
    readonly max: number;
  };
}
 
/**
 * Stance guard animation configuration
 * 
 * Extends base AnimationConfig with stance-specific guard pose data.
 * Includes 4-6 frame breathing animation for realistic idle behavior.
 * 
 * @public
 * @category Animation
 * @korean 자세방어애니메이션설정
 */
export interface StanceGuardAnimationConfig {
  /**
   * Trigram stance identifier
   * @korean 괘
   */
  readonly stance: string;
 
  /**
   * Korean name of stance
   * @korean 한글이름
   */
  readonly koreanName: string;
 
  /**
   * English name of stance
   * @korean 영어이름
   */
  readonly englishName: string;
 
  /**
   * Guard pose keyframe (default position)
   * @korean 방어포즈
   */
  readonly guardPose: StanceGuardPose;
 
  /**
   * Breathing animation frames (4-6 frames)
   * @korean 호흡프레임
   */
  readonly breathingFrames: number;
 
  /**
   * Target frames per second (60fps)
   * @korean 초당프레임
   */
  readonly fps: number;
 
  /**
   * Breathing cycle loop enabled
   * @korean 반복여부
   */
  readonly loop: boolean;
 
  /**
   * Animation priority (0 for idle guards)
   * @korean 우선순위
   */
  readonly priority: number;
}
 
/**
 * Mirror a guard pose for left/right stance laterality.
 * 
 * **Korean**: 자세 좌우 대칭
 * 
 * Creates a mirror-image guard pose by swapping left and right limb positions
 * and negating lateral (Y-axis and Z-axis) rotations. This enables authentic
 * left/right stance differentiation in Korean martial arts.
 * 
 * Key transformations:
 * - Swap leftArm ↔ rightArm bone rotations
 * - Negate Y rotation (lateral twist)
 * - Negate Z rotation (roll)
 * - Preserve X rotation (forward/back bend)
 * - Keep weight distribution and breathing range unchanged
 * 
 * @param pose - Original guard pose to mirror
 * @returns Mirrored guard pose with swapped and negated rotations
 * 
 * @example
 * ```typescript
 * // Create right-handed version of a left-handed guard
 * const leftGeonGuard = GEON_HIGH_GUARD_POSE;
 * const rightGeonGuard = mirrorGuardPose(leftGeonGuard);
 * 
 * // leftGeonGuard has left hand forward
 * // rightGeonGuard has right hand forward (mirrored)
 * ```
 * 
 * @public
 * @category Animation
 * @korean 방어포즈대칭
 */
export function mirrorGuardPose(pose: StanceGuardPose): StanceGuardPose {
  // Helper to negate Y and Z rotations while preserving X
  const mirrorEuler = (euler: THREE.Euler): THREE.Euler => {
    return new THREE.Euler(
      euler.x,      // Preserve forward/back bend
      -euler.y,     // Negate lateral twist
      -euler.z      // Negate roll
    );
  };
 
  return {
    // Swap left and right arms with mirrored rotations
    leftArm: {
      shoulder: mirrorEuler(pose.rightArm.shoulder),
      elbow: mirrorEuler(pose.rightArm.elbow),
      wrist: mirrorEuler(pose.rightArm.wrist),
    },
    rightArm: {
      shoulder: mirrorEuler(pose.leftArm.shoulder),
      elbow: mirrorEuler(pose.leftArm.elbow),
      wrist: mirrorEuler(pose.leftArm.wrist),
    },
    // Mirror torso rotation
    torso: mirrorEuler(pose.torso),
    // NEW: Swap and mirror leg positions
    leftLeg: {
      hip: mirrorEuler(pose.rightLeg.hip),
      knee: mirrorEuler(pose.rightLeg.knee),
      ankle: mirrorEuler(pose.rightLeg.ankle),
    },
    rightLeg: {
      hip: mirrorEuler(pose.leftLeg.hip),
      knee: mirrorEuler(pose.leftLeg.knee),
      ankle: mirrorEuler(pose.leftLeg.ankle),
    },
    // Mirror pelvis rotation
    pelvis: mirrorEuler(pose.pelvis),
    // Stance width remains the same
    stanceWidth: pose.stanceWidth,
    // Weight distribution remains the same
    weight: pose.weight,
    // Breathing range unchanged (not affected by laterality, reuse original object)
    breathingRange: pose.breathingRange,
  };
}