@sage-rsc/talking-head-react 1.5.8 → 1.5.10
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 +0 -24
- package/package.json +1 -1
- package/src/lib/talkinghead.mjs +16 -2
package/dist/index.js
CHANGED
|
@@ -4391,22 +4391,12 @@ 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
4394
|
}
|
|
4396
4395
|
/**
|
|
4397
4396
|
* Apply shoulder adjustment to lower shoulders to a more natural position
|
|
4398
4397
|
* This is called from updatePoseBase for pose-based animations
|
|
4399
4398
|
*/
|
|
4400
4399
|
applyShoulderAdjustment() {
|
|
4401
|
-
const t = new y.Euler(), e = 0.6, n = 0.7;
|
|
4402
|
-
if (this.poseAvatar.props["LeftShoulder.quaternion"]) {
|
|
4403
|
-
const i = this.poseAvatar.props["LeftShoulder.quaternion"];
|
|
4404
|
-
t.setFromQuaternion(i, "XYZ"), t.x > n ? t.x = e : t.x > e && (t.x = e + (t.x - e) * 0.2), i.setFromEuler(t, "XYZ");
|
|
4405
|
-
}
|
|
4406
|
-
if (this.poseAvatar.props["RightShoulder.quaternion"]) {
|
|
4407
|
-
const i = this.poseAvatar.props["RightShoulder.quaternion"];
|
|
4408
|
-
t.setFromQuaternion(i, "XYZ"), t.x > n ? t.x = e : t.x > e && (t.x = e + (t.x - e) * 0.2), i.setFromEuler(t, "XYZ");
|
|
4409
|
-
}
|
|
4410
4400
|
}
|
|
4411
4401
|
/**
|
|
4412
4402
|
* Apply shoulder adjustment directly to bone objects
|
|
@@ -4415,20 +4405,6 @@ class Be {
|
|
|
4415
4405
|
* and rotation should be dampened to prevent freakishly high positions
|
|
4416
4406
|
*/
|
|
4417
4407
|
applyShoulderAdjustmentToBones() {
|
|
4418
|
-
if (!this.armature) return;
|
|
4419
|
-
const t = this.armature.getObjectByName("LeftShoulder"), e = this.armature.getObjectByName("RightShoulder");
|
|
4420
|
-
if (!t || !e) return;
|
|
4421
|
-
const n = new y.Euler(), i = new y.Quaternion(), s = 0.6, o = 0.7;
|
|
4422
|
-
if (t.quaternion) {
|
|
4423
|
-
n.setFromQuaternion(t.quaternion, "XYZ");
|
|
4424
|
-
const l = n.x;
|
|
4425
|
-
n.x > o ? n.x = s : n.x > s && (n.x = s + (n.x - s) * 0.2), Math.abs(n.x - l) > 0.01 && (i.setFromEuler(n, "XYZ"), t.quaternion.copy(i), t.updateMatrix(), t.parent ? t.matrixWorld.multiplyMatrices(t.parent.matrixWorld, t.matrix) : t.matrixWorld.copy(t.matrix));
|
|
4426
|
-
}
|
|
4427
|
-
if (e.quaternion) {
|
|
4428
|
-
n.setFromQuaternion(e.quaternion, "XYZ");
|
|
4429
|
-
const l = n.x;
|
|
4430
|
-
n.x > o ? n.x = s : n.x > s && (n.x = s + (n.x - s) * 0.2), Math.abs(n.x - l) > 0.01 && (i.setFromEuler(n, "XYZ"), e.quaternion.copy(i), e.updateMatrix(), e.parent ? e.matrixWorld.multiplyMatrices(e.parent.matrixWorld, e.matrix) : e.matrixWorld.copy(e.matrix));
|
|
4431
|
-
}
|
|
4432
4408
|
}
|
|
4433
4409
|
/**
|
|
4434
4410
|
* Update avatar pose deltas
|
package/package.json
CHANGED
package/src/lib/talkinghead.mjs
CHANGED
|
@@ -1609,8 +1609,8 @@ class TalkingHead {
|
|
|
1609
1609
|
}
|
|
1610
1610
|
}
|
|
1611
1611
|
|
|
1612
|
-
//
|
|
1613
|
-
this.applyShoulderAdjustment();
|
|
1612
|
+
// TEMPORARILY DISABLED - No shoulder adjustments
|
|
1613
|
+
// this.applyShoulderAdjustment();
|
|
1614
1614
|
}
|
|
1615
1615
|
|
|
1616
1616
|
/**
|
|
@@ -1618,6 +1618,9 @@ class TalkingHead {
|
|
|
1618
1618
|
* This is called from updatePoseBase for pose-based animations
|
|
1619
1619
|
*/
|
|
1620
1620
|
applyShoulderAdjustment() {
|
|
1621
|
+
// TEMPORARILY DISABLED - No arm/shoulder adjustments
|
|
1622
|
+
return;
|
|
1623
|
+
|
|
1621
1624
|
const tempEuler = new THREE.Euler();
|
|
1622
1625
|
const targetX = 0.6; // Target X rotation for relaxed shoulders - lowered significantly
|
|
1623
1626
|
const maxX = 0.7; // Maximum X rotation - lowered significantly
|
|
@@ -1656,8 +1659,18 @@ class TalkingHead {
|
|
|
1656
1659
|
* and rotation should be dampened to prevent freakishly high positions
|
|
1657
1660
|
*/
|
|
1658
1661
|
applyShoulderAdjustmentToBones() {
|
|
1662
|
+
// TEMPORARILY DISABLED - No arm/shoulder adjustments
|
|
1663
|
+
return;
|
|
1664
|
+
|
|
1659
1665
|
if (!this.armature) return;
|
|
1660
1666
|
|
|
1667
|
+
// Only apply shoulder adjustment when FBX animations are playing
|
|
1668
|
+
// This prevents interference with normal pose system (idle, wide, side, etc.)
|
|
1669
|
+
const isFBXPlaying = this.mixer && this.currentFBXAction && this.currentFBXAction.isRunning();
|
|
1670
|
+
if (!isFBXPlaying) {
|
|
1671
|
+
return; // Don't adjust shoulders during normal poses
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1661
1674
|
// Get shoulder bones directly from armature
|
|
1662
1675
|
const leftShoulderBone = this.armature.getObjectByName('LeftShoulder');
|
|
1663
1676
|
const rightShoulderBone = this.armature.getObjectByName('RightShoulder');
|
|
@@ -1671,6 +1684,7 @@ class TalkingHead {
|
|
|
1671
1684
|
// Natural relaxed shoulders: X rotation ~0.5-0.7 radians (much lower for natural look)
|
|
1672
1685
|
// High/stiff shoulders: X rotation ~1.5-1.8 radians
|
|
1673
1686
|
// We aggressively clamp to a very relaxed position
|
|
1687
|
+
// Only apply this during FBX animations to prevent high shoulders from animation data
|
|
1674
1688
|
const targetX = 0.6; // Target X rotation for relaxed, natural shoulders (radians) - lowered significantly
|
|
1675
1689
|
const maxX = 0.7; // Maximum allowed X rotation - lowered significantly
|
|
1676
1690
|
|