From 114e883f5b139ffb3329715e2f248b91264340ec Mon Sep 17 00:00:00 2001 From: jessikitty Date: Wed, 8 Jul 2026 12:26:48 +1000 Subject: [PATCH] Jitter Amoothing --- public/js/detect-tuned.js | 7 ++++++- public/js/exhibit.js | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/public/js/detect-tuned.js b/public/js/detect-tuned.js index faf5afc..d20c210 100644 --- a/public/js/detect-tuned.js +++ b/public/js/detect-tuned.js @@ -100,7 +100,12 @@ export class TunedDetector { * smoothing (kills jitter); moving fast => light smoothing (stays responsive). */ class OneEuro { - constructor(minCutoff = 1.2, beta = 0.012, dCutoff = 1.0) { + // minCutoff: baseline smoothing when still (lower = smoother but laggier). + // beta: how aggressively smoothing backs off as the value moves (higher = + // snappier tracking when you pan the phone, so ghosts follow the camera). + // Tuned for AR panning: keep jitter down when still, but track fast motion + // almost 1:1 so the world doesn't lag behind the camera. + constructor(minCutoff = 1.7, beta = 0.15, dCutoff = 1.0) { this.minCutoff = minCutoff; this.beta = beta; this.dCutoff = dCutoff; this.xPrev = null; this.dxPrev = 0; this.tPrev = null; } diff --git a/public/js/exhibit.js b/public/js/exhibit.js index a4fc992..0cae294 100644 --- a/public/js/exhibit.js +++ b/public/js/exhibit.js @@ -270,7 +270,7 @@ async function start() { return; } detector = new TunedDetector({ dictionaryName: 'ARUCO_4X4_1000' }).setPreset('forgiving'); - tracker = new MarkerTracker({ coastMs: 300, smooth: true }); + tracker = new MarkerTracker({ coastMs: 120, smooth: true }); // short coast: don't linger on stale pose while panning await new Promise((res) => { if (video.readyState >= 2) res(); else video.onloadeddata = () => res(); }); sizeAll(); @@ -327,7 +327,7 @@ function loop(now) { // 3) animate ghosts: smooth toward server target, apply yaw + idle wobble const t = now / 1000; for (const obj of ghostObjs.values()) { - obj.group.position.lerp(obj.targetPos, 0.25); // smooth network updates + obj.group.position.lerp(obj.targetPos, 0.5); // smooth network updates (snappier follow) if (obj._yaw != null) { // face travel/authored yaw, eased const cur = obj.group.rotation.y;