@sage-rsc/talking-head-react 1.2.0 → 1.2.2
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 +444 -466
- package/package.json +1 -1
- package/src/lib/talkinghead.mjs +3 -46
package/package.json
CHANGED
package/src/lib/talkinghead.mjs
CHANGED
|
@@ -5663,52 +5663,9 @@ class TalkingHead {
|
|
|
5663
5663
|
const newTrack = track.clone();
|
|
5664
5664
|
newTrack.name = newTrackName;
|
|
5665
5665
|
|
|
5666
|
-
//
|
|
5667
|
-
//
|
|
5668
|
-
|
|
5669
|
-
const isLeftSide = mappedBoneName.includes('Left');
|
|
5670
|
-
const isRightSide = mappedBoneName.includes('Right');
|
|
5671
|
-
const isForearm = mappedBoneName.includes('ForeArm') || mappedBoneName.includes('Forearm');
|
|
5672
|
-
const isHand = mappedBoneName.includes('Hand') && !mappedBoneName.includes('Index') &&
|
|
5673
|
-
!mappedBoneName.includes('Thumb') && !mappedBoneName.includes('Middle') &&
|
|
5674
|
-
!mappedBoneName.includes('Ring') && !mappedBoneName.includes('Pinky');
|
|
5675
|
-
|
|
5676
|
-
if (isArmBone && (property === 'quaternion' || property === 'rotation')) {
|
|
5677
|
-
if (property === 'quaternion' && newTrack.values && newTrack.values.length >= 4) {
|
|
5678
|
-
// Adjust quaternion rotations for Ready Player Me coordinate system
|
|
5679
|
-
const numKeyframes = newTrack.times.length;
|
|
5680
|
-
for (let i = 0; i < numKeyframes; i++) {
|
|
5681
|
-
const baseIdx = i * 4;
|
|
5682
|
-
if (baseIdx + 3 < newTrack.values.length) {
|
|
5683
|
-
let x = newTrack.values[baseIdx];
|
|
5684
|
-
let y = newTrack.values[baseIdx + 1];
|
|
5685
|
-
let z = newTrack.values[baseIdx + 2];
|
|
5686
|
-
let w = newTrack.values[baseIdx + 3];
|
|
5687
|
-
|
|
5688
|
-
const q = new THREE.Quaternion(x, y, z, w);
|
|
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);
|
|
5702
|
-
}
|
|
5703
|
-
|
|
5704
|
-
newTrack.values[baseIdx] = q.x;
|
|
5705
|
-
newTrack.values[baseIdx + 1] = q.y;
|
|
5706
|
-
newTrack.values[baseIdx + 2] = q.z;
|
|
5707
|
-
newTrack.values[baseIdx + 3] = q.w;
|
|
5708
|
-
}
|
|
5709
|
-
}
|
|
5710
|
-
}
|
|
5711
|
-
}
|
|
5666
|
+
// Note: Rotation corrections removed - they were causing issues with both arms
|
|
5667
|
+
// If left arm still has issues, it's likely a bone mapping problem, not rotation
|
|
5668
|
+
// Focus on getting bone names mapped correctly first
|
|
5712
5669
|
|
|
5713
5670
|
mappedTracks.push(newTrack);
|
|
5714
5671
|
|