Avatar works seated: only shoulders required, bust mode without hips
Sitting at a desk the hips are rarely visible, which made the avatar never appear. The pelvis is now synthesized below the shoulders when hidden (torso/head/arms as a bust; legs return when actually visible). The output also reports diagnostics to the panel: pose tracker failed, or avatar active with no body detected for 5s. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
08414070a9
commit
a0edb14d1e
2 files changed
+30
-7
No files matched your search
+11
-6
@@ -1027,15 +1027,20 @@ class InteractiveSim {
|
||||
// tracked skeleton 1:1 — raise your arm and the robot raises its arm.
|
||||
if (mode === 'avatar') {
|
||||
const L = this.lmsRaw;
|
||||
const ok = this.modelSim && L && L[11] && L[11].vis > 0.5 && L[12].vis > 0.5
|
||||
&& L[23].vis > 0.4 && L[24].vis > 0.4;
|
||||
// Only the shoulders are required: seated at a desk the hips are often
|
||||
// hidden, so the pelvis is synthesized and the robot shows as a bust.
|
||||
const ok = this.modelSim && L && L[11] && L[11].vis > 0.5 && L[12].vis > 0.5;
|
||||
if (!ok) { this._drawField(7, e, audio, canvas, 0); return; }
|
||||
const S = 2.6;
|
||||
const W = (i) => [(L[i].x - 0.5)*S, (0.5 - L[i].y)*S, -(L[i].z || 0)*1.2];
|
||||
const mid = (p, q) => [(p[0]+q[0])/2, (p[1]+q[1])/2, (p[2]+q[2])/2];
|
||||
const sh1 = W(11), sh2 = W(12), hp1 = W(23), hp2 = W(24);
|
||||
const neck = mid(sh1, sh2), pelvis = mid(hp1, hp2);
|
||||
const sh1 = W(11), sh2 = W(12);
|
||||
const neck = mid(sh1, sh2);
|
||||
const shw = Math.max(0.15, Math.hypot(sh1[0]-sh2[0], sh1[1]-sh2[1], sh1[2]-sh2[2]));
|
||||
const hipsVis = L[23].vis > 0.4 && L[24].vis > 0.4;
|
||||
const hp1 = hipsVis ? W(23) : [neck[0]-shw*0.28, neck[1]-shw*1.25, neck[2]];
|
||||
const hp2 = hipsVis ? W(24) : [neck[0]+shw*0.28, neck[1]-shw*1.25, neck[2]];
|
||||
const pelvis = mid(hp1, hp2);
|
||||
const t = shw;
|
||||
const metal = [0.60, 0.64, 0.72], dark = [0.28, 0.30, 0.36];
|
||||
const acc = e.colorB || [0.2, 1, 1];
|
||||
@@ -1063,9 +1068,9 @@ class InteractiveSim {
|
||||
};
|
||||
arm(sh1, 13, 15); arm(sh2, 14, 16);
|
||||
ball(sh1, t*0.16, dark); ball(sh2, t*0.16, dark);
|
||||
// legs with feet
|
||||
// legs with feet (only when actually visible: seated = bust only)
|
||||
const leg = (h, knI, anI) => {
|
||||
if (L[knI].vis < 0.4 || L[anI].vis < 0.4) return;
|
||||
if (!hipsVis || L[knI].vis < 0.4 || L[anI].vis < 0.4) return;
|
||||
const kn = W(knI), an = W(anI);
|
||||
limb(h, kn, t*0.16, metal);
|
||||
limb(kn, an, t*0.13, metal);
|
||||
|
||||
Reference in new issue
Block a user