@sage-rsc/talking-head-react 1.3.5 → 1.3.7
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 +15 -0
- package/package.json +1 -1
- package/src/lib/talkinghead.mjs +28 -0
package/dist/index.js
CHANGED
|
@@ -4391,6 +4391,21 @@ class Be {
|
|
|
4391
4391
|
s > 1 || !this.poseBase.props.hasOwnProperty(e) ? i.copy(n) : i.isQuaternion ? i.copy(this.poseBase.props[e].slerp(n, this.easing(s))) : i.isVector3 && i.copy(this.poseBase.props[e].lerp(n, this.easing(s)));
|
|
4392
4392
|
}
|
|
4393
4393
|
}
|
|
4394
|
+
this.applyShoulderAdjustment();
|
|
4395
|
+
}
|
|
4396
|
+
/**
|
|
4397
|
+
* Apply shoulder adjustment to lower shoulders to a more natural position
|
|
4398
|
+
*/
|
|
4399
|
+
applyShoulderAdjustment() {
|
|
4400
|
+
const e = new y.Euler();
|
|
4401
|
+
if (this.poseAvatar.props["LeftShoulder.quaternion"]) {
|
|
4402
|
+
const n = this.poseAvatar.props["LeftShoulder.quaternion"];
|
|
4403
|
+
e.setFromQuaternion(n, "XYZ"), e.x += -0.6, n.setFromEuler(e, "XYZ");
|
|
4404
|
+
}
|
|
4405
|
+
if (this.poseAvatar.props["RightShoulder.quaternion"]) {
|
|
4406
|
+
const n = this.poseAvatar.props["RightShoulder.quaternion"];
|
|
4407
|
+
e.setFromQuaternion(n, "XYZ"), e.x += -0.6, n.setFromEuler(e, "XYZ");
|
|
4408
|
+
}
|
|
4394
4409
|
}
|
|
4395
4410
|
/**
|
|
4396
4411
|
* Update avatar pose deltas
|
package/package.json
CHANGED
package/src/lib/talkinghead.mjs
CHANGED
|
@@ -1608,6 +1608,34 @@ class TalkingHead {
|
|
|
1608
1608
|
}
|
|
1609
1609
|
}
|
|
1610
1610
|
}
|
|
1611
|
+
|
|
1612
|
+
// Apply shoulder adjustment to lower shoulders
|
|
1613
|
+
this.applyShoulderAdjustment();
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
/**
|
|
1617
|
+
* Apply shoulder adjustment to lower shoulders to a more natural position
|
|
1618
|
+
*/
|
|
1619
|
+
applyShoulderAdjustment() {
|
|
1620
|
+
// Shoulder adjustment: reduce X-axis rotation by ~0.6 radians (34 degrees) to lower shoulders to a relaxed position
|
|
1621
|
+
const shoulderAdjustment = -0.6; // Negative to lower shoulders (increased for more relaxed look)
|
|
1622
|
+
const tempEuler = new THREE.Euler();
|
|
1623
|
+
|
|
1624
|
+
// Adjust left shoulder
|
|
1625
|
+
if (this.poseAvatar.props['LeftShoulder.quaternion']) {
|
|
1626
|
+
const leftShoulder = this.poseAvatar.props['LeftShoulder.quaternion'];
|
|
1627
|
+
tempEuler.setFromQuaternion(leftShoulder, 'XYZ');
|
|
1628
|
+
tempEuler.x += shoulderAdjustment; // Reduce X rotation to lower shoulder
|
|
1629
|
+
leftShoulder.setFromEuler(tempEuler, 'XYZ');
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
// Adjust right shoulder
|
|
1633
|
+
if (this.poseAvatar.props['RightShoulder.quaternion']) {
|
|
1634
|
+
const rightShoulder = this.poseAvatar.props['RightShoulder.quaternion'];
|
|
1635
|
+
tempEuler.setFromQuaternion(rightShoulder, 'XYZ');
|
|
1636
|
+
tempEuler.x += shoulderAdjustment; // Reduce X rotation to lower shoulder
|
|
1637
|
+
rightShoulder.setFromEuler(tempEuler, 'XYZ');
|
|
1638
|
+
}
|
|
1611
1639
|
}
|
|
1612
1640
|
|
|
1613
1641
|
/**
|