@sage-rsc/talking-head-react 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sage-rsc/talking-head-react",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "A reusable React component for 3D talking avatars with lip-sync and text-to-speech",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -5685,20 +5685,26 @@ class TalkingHead {
5685
5685
  let z = newTrack.values[baseIdx + 2];
5686
5686
  let w = newTrack.values[baseIdx + 3];
5687
5687
 
5688
- const q = new THREE.Quaternion(x, y, z, w);
5688
+ let q = new THREE.Quaternion(x, y, z, w);
5689
5689
 
5690
- // For Ready Player Me, hands may need coordinate system correction
5691
- // Hands folding behind suggests we need to rotate around Y axis
5692
- if (isHand) {
5693
- // Rotate 180 degrees around Y axis to fix hands folding behind
5694
- const flipY = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0), Math.PI);
5695
- // Apply rotation: q_result = q_original * q_flip (post-multiply)
5696
- q.multiply(flipY);
5697
- } else if (isForearm) {
5698
- // For forearms, try a smaller correction - rotate 90 degrees around Z axis
5699
- // This might help with the twisting
5700
- const adjustZ = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 0, 1), Math.PI / 2);
5701
- q.multiply(adjustZ);
5690
+ // For Ready Player Me, left side bones may need coordinate system correction
5691
+ // Try multiple approaches: invert quaternion or rotate around different axes
5692
+ if (isLeftSide) {
5693
+ if (isHand) {
5694
+ // Left hand: Try inverting the quaternion (conjugate) to flip orientation
5695
+ // This might fix the "folding behind" issue
5696
+ q.conjugate();
5697
+ // Then rotate 180 degrees around Y axis
5698
+ const flipY = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0), Math.PI);
5699
+ q = flipY.multiply(q);
5700
+ } else if (isForearm) {
5701
+ // Left forearm: Try rotating 180 degrees around Y axis first
5702
+ const flipY = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0), Math.PI);
5703
+ q = flipY.multiply(q);
5704
+ // Then rotate 90 degrees around X axis
5705
+ const adjustX = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(1, 0, 0), Math.PI / 2);
5706
+ q = adjustX.multiply(q);
5707
+ }
5702
5708
  }
5703
5709
 
5704
5710
  newTrack.values[baseIdx] = q.x;