fix(handtracking): stabilize provider root and linger enabled
(1) HandTrackingProvider always renders the same JSX root (HandTrackingRuntime) so toggling `enabled` no longer remounts the <Canvas> below — that remount was destroying the WebGL context every time the player entered an interaction zone. (2) Add HAND_TRACKING_LINGER_MS (2s) cooldown on `enabled` so brief walk-throughs of a trigger zone don't tear down MediaPipe before it has time to initialize the webcam + model + first frame (cold start ~800ms). Resolves the WebGL context lost + respawn loop and restores visible hand tracking in the backend runtime. Browser JS runtime detection quality is a separate follow-up. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -14,3 +14,9 @@ export const HAND_TRACKING_BROWSER_DELEGATE: "CPU" | "GPU" = "CPU";
|
||||
// Absorbs React StrictMode's mount/unmount/mount cycle in dev and rapid
|
||||
// `nearby` toggles at trigger borders. Invisible to the user (~5 frames).
|
||||
export const HAND_TRACKING_RUNTIME_START_DELAY_MS = 80;
|
||||
|
||||
// How long the hand tracking stays active after the trigger condition
|
||||
// (nearby / holding / repair step) turns off. Gives MediaPipe enough time
|
||||
// to initialize webcam + model + first frame inference before we cleanup,
|
||||
// so the user actually sees their hands when entering a zone briefly.
|
||||
export const HAND_TRACKING_LINGER_MS = 2000;
|
||||
|
||||
Reference in New Issue
Block a user