Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(docs-world): make the 3D fallback recoverable and stop T-posed rigs

nirholas8a43090df832
diff --git a/public/docs-world.css b/public/docs-world.css
index f117ad628..702426aeb 100644
--- a/public/docs-world.css
+++ b/public/docs-world.css
@@ -546,6 +546,13 @@ body {
font-size: 14px;
line-height: 1.6;
}
+.dw-fallback-actions {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 10px;
+ justify-content: center;
+}
+
.dw-spinner {
width: 34px;
height: 34px;
diff --git a/src/docs-world/main.js b/src/docs-world/main.js
index ed04c05ea..0c9f38d2b 100644
--- a/src/docs-world/main.js
+++ b/src/docs-world/main.js
@@ -45,12 +45,15 @@ function showFallback({ title, message, retry = false } = {}) {
if (message) $('dw-fallback-sub').textContent = message;
const retryBtn = $('dw-fallback-retry');
retryBtn.hidden = !retry;
+ // Reveal BEFORE focusing: a still-hidden element cannot take focus, so the
+ // keyboard would have been left on <body> with the recovery action unreachable
+ // without tabbing for it.
+ $('dw-fallback').hidden = false;
+ $('dw-loading').hidden = true;
if (retry) {
retryBtn.onclick = () => location.reload();
retryBtn.focus({ preventScroll: true });
}
- $('dw-fallback').hidden = false;
- $('dw-loading').hidden = true;
}
async function boot() {
@@ -85,8 +88,16 @@ async function boot() {
try {
world = createDocsWorld(canvas, sections, { reducedMotion });
} catch {
- // createRenderer already mounted its own panel; ours routes to the docs.
- showFallback();
+ // createRenderer already mounted its own panel; ours covers the screen and
+ // routes onward. Retry is offered because the most common cause here is not
+ // a GPU-less device (isWebGLAvailable already cleared that above) but an
+ // exhausted per-tab context budget, which a reload genuinely clears.
+ showFallback({
+ title: 'The 3D view could not start',
+ message:
+ 'The browser refused a graphics context, usually because too many 3D views are open at once. Reloading normally fixes it; the classic docs need no 3D at all.',
+ retry: true,
+ });
return;
}
@@ -290,5 +301,10 @@ async function boot() {
boot().catch((err) => {
log.error('[docs-world] boot failed', err);
- showFallback();
+ showFallback({
+ title: 'The world stopped before it opened',
+ message:
+ 'Something failed while building the scene. Reloading often clears it, and the classic docs carry every page this world shows.',
+ retry: true,
+ });
});
diff --git a/src/docs-world/player.js b/src/docs-world/player.js
index 224c5f8d8..5cd0d4a39 100644
--- a/src/docs-world/player.js
+++ b/src/docs-world/player.js
@@ -114,13 +114,26 @@ export function createPlayer(scene, renderer, { avatarUrl = DEFAULT_BODY_GLB } =
root.add(model);
anim.attach(model, { avatarUrl });
+ // Before any clip plays: on a rig whose upper arms could not be
+ // name-mapped, the retarget drives torso and legs but leaves the arms
+ // at their authored bind pose, i.e. a T-pose. Custom ?avatar= rigs are
+ // exactly where that happens, so relax them into a rest pose first.
+ anim.relaxUndrivenArms();
try {
const defs = await fetch('/animations/manifest.json').then((r) => (r.ok ? r.json() : []));
if (Array.isArray(defs) && defs.length) {
anim.setAnimationDefs(defs);
const ok = await anim.ensureLoaded(CLIP_IDLE);
- if (ok) await anim.crossfadeTo(CLIP_IDLE, 0);
- currentClip = CLIP_IDLE;
+ // Only claim the idle clip once it is actually playing. Recording
+ // it unconditionally was self-defeating: the walk/idle switch below
+ // skips any clip equal to currentClip, so a failed idle load left
+ // the body frozen in its bind pose AND marked idle as current, so
+ // nothing ever retried it. Leaving it null lets the first tick
+ // re-attempt the crossfade.
+ if (ok) {
+ await anim.crossfadeTo(CLIP_IDLE, 0);
+ currentClip = CLIP_IDLE;
+ }
anim.ensureLoaded(CLIP_WALK).catch(() => {});
}
} catch (err) {