@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/dist/index.cjs +2 -2
- package/dist/index.js +332 -340
- package/package.json +1 -1
- package/src/lib/talkinghead.mjs +19 -13
package/package.json
CHANGED
package/src/lib/talkinghead.mjs
CHANGED
|
@@ -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
|
-
|
|
5688
|
+
let q = new THREE.Quaternion(x, y, z, w);
|
|
5689
5689
|
|
|
5690
|
-
// For Ready Player Me,
|
|
5691
|
-
//
|
|
5692
|
-
if (
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
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;
|