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: anchor name/bubble to avatar head height; harden Cloud Run deploy

nirholas418ce02d060c
diff --git a/multiplayer/deploy-cloudrun.sh b/multiplayer/deploy-cloudrun.sh
index 00d49a3e0..a48974620 100755
--- a/multiplayer/deploy-cloudrun.sh
+++ b/multiplayer/deploy-cloudrun.sh
@@ -38,8 +38,15 @@ echo "Deploying '${SERVICE}' to Cloud Run (project=${PROJECT}, region=${REGION})
# --session-affinity : best-effort sticky sessions for WS reconnects.
# --timeout 3600 : Cloud Run's max WS lifetime (60 min); client reconnects.
# --port 2567 : container listens here (matches Dockerfile/fly.toml).
+# A fresh project's default compute service account can take minutes to appear
+# (and some org policies block its auto-creation), so builds use a dedicated SA.
+BUILD_SA="${BUILD_SA:-projects/${PROJECT}/serviceAccounts/three-ws-build@${PROJECT}.iam.gserviceaccount.com}"
+
gcloud run deploy "${SERVICE}" \
--source . \
+ --quiet \
+ --build-service-account "${BUILD_SA}" \
+ --service-account "three-ws-build@${PROJECT}.iam.gserviceaccount.com" \
--region "${REGION}" \
--platform managed \
--allow-unauthenticated \
@@ -51,7 +58,7 @@ gcloud run deploy "${SERVICE}" \
--cpu 1 \
--timeout 3600 \
--session-affinity \
- --set-env-vars "NODE_ENV=production,ALLOWED_ORIGINS=${ALLOWED_ORIGINS}"
+ --set-env-vars "^@^NODE_ENV=production@ALLOWED_ORIGINS=${ALLOWED_ORIGINS}"
URL="$(gcloud run services describe "${SERVICE}" --region "${REGION}" --format 'value(status.url)')"
WSS="${URL/https:/wss:}"
diff --git a/src/game/coincommunities.js b/src/game/coincommunities.js
index 9352a4f77..f1eea961d 100644
--- a/src/game/coincommunities.js
+++ b/src/game/coincommunities.js
@@ -108,6 +108,7 @@ class RemotePlayer {
this.bubble = null;
this._bubbleTimer = null;
+ this.height = 1.7; // avatar head height; updated once the GLB measures
this.setAvatar(player.avatar);
}
@@ -117,7 +118,8 @@ class RemotePlayer {
// rebuild model
this.rig.clear();
this.anim = new AnimationManager();
- resolveAvatarUrl(url).then((u) => buildAvatar(this.rig, u, this.anim).then(() => {
+ resolveAvatarUrl(url).then((u) => buildAvatar(this.rig, u, this.anim).then(({ height }) => {
+ this.height = height;
this.anim.crossfadeTo(this.motion === 'walk' || this.motion === 'run' ? CLIP_WALK : CLIP_IDLE, 0);
}));
}
@@ -364,7 +366,8 @@ export class CoinCommunities {
this.localAnim = new AnimationManager();
const avatarInput = this.ui.getAvatar();
const url = await resolveAvatarUrl(avatarInput);
- await buildAvatar(this.localRig, url, this.localAnim);
+ const { height: localHeight } = await buildAvatar(this.localRig, url, this.localAnim);
+ this.localHeight = localHeight;
// Connect to this coin's room.
const name = localStorage.getItem('cc-name') || ('guest-' + Math.random().toString(36).slice(2, 6));
@@ -533,11 +536,13 @@ export class CoinCommunities {
node.style.display = '';
node.style.transform = `translate(-50%, -100%) translate(${(v.x * 0.5 + 0.5) * w}px, ${(-v.y * 0.5 + 0.5) * h}px)`;
};
+ // Anchor name + bubble to each avatar's real head height so they sit just
+ // above the head regardless of how tall/short the GLB is.
for (const [, r] of this.remotes) {
- place(r.label, r.rig.position, 2.0);
- if (r.bubble) place(r.bubble, r.rig.position, 2.5);
+ place(r.label, r.rig.position, r.height + 0.2);
+ if (r.bubble) place(r.bubble, r.rig.position, r.height + 0.7);
}
- if (this._localBubble && this.localRig) place(this._localBubble, this.localPos, 2.5);
+ if (this._localBubble && this.localRig) place(this._localBubble, this.localPos, (this.localHeight || 1.7) + 0.7);
}
_onResize() {