From 774822fb6a0840eabae158580795c95bce805df1 Mon Sep 17 00:00:00 2001 From: jessikitty Date: Fri, 24 Jul 2026 14:11:17 +1000 Subject: [PATCH] Apply scene ghost height to viewer ghosts, live on scene updates --- public/js/exhibit.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/public/js/exhibit.js b/public/js/exhibit.js index cd4245e..cd0e4b6 100644 --- a/public/js/exhibit.js +++ b/public/js/exhibit.js @@ -16,6 +16,7 @@ let info = { mode: 'dev' }; let scene3, camera3, renderer, video, canvas2d, ctx2d; let detector, poseEst, fuser; let gradients = {}, modelManifest = null; +let ghostHeight = 4; // cm, from scene.ghostHeightCm const activeGhosts = new Map(); // uid -> { rec, group } let tracking = { markers: 0, lastSeen: 0 }; const clockOffsetSamples = []; @@ -62,7 +63,11 @@ async function start() { // network const net = new ExhibitNet(); - net.on('scene', (m) => { fuser.setScene(m.scene); buildOcclusion(m.scene); }) + net.on('scene', (m) => { + fuser.setScene(m.scene); buildOcclusion(m.scene); + ghostHeight = m.scene.ghostHeightCm || 4; + for (const e of activeGhosts.values()) e.group.userData.setHeight(ghostHeight); + }) .on('active', async (m) => { for (const uid of [...activeGhosts.keys()]) removeGhost(uid); for (const rec of m.ghosts) await addGhost(rec); @@ -107,6 +112,7 @@ function buildOcclusion(scene) { async function addGhost(rec) { if (activeGhosts.has(rec.uid)) return; const group = await buildGhost(rec, gradients, modelManifest); + group.userData.setHeight(ghostHeight); scene3.add(group); activeGhosts.set(rec.uid, { rec, group }); toast(`${rec.name} appeared`);