Skip to content

Commit

Permalink
fix(hand-tracker): handle errors with hand detection
Browse files Browse the repository at this point in the history
  • Loading branch information
danferns committed Oct 26, 2023
1 parent f4d5a7d commit c7135ef
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/svelte/nodes/io/hand-tracker.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
emit("MIDI", 0xb0, 3, handDirectionValue);
}
}
function processHandDirectionGesture(hand:handdetection.Hand, side: string): number {
function processHandDirectionGesture(hand: handdetection.Hand, side: string): number {
const direction = getHandDirectionValue(hand);
let value = direction * 0.5 + 0.5;
if (side === "right") {
Expand All @@ -101,7 +101,7 @@
const wristIndex = indexBase.minus(wrist).normalize();
const wristPinky = pinkyBase.minus(wrist).normalize();
const palmVector = wristIndex.cross(wristPinky);
return palmVector.normalize().dot(new Vec3(0, 0, 1));
}
Expand Down Expand Up @@ -215,7 +215,11 @@
}
async function renderPrediction() {
await renderResult();
try {
await renderResult();
} catch (e) {
console.error(e);
}
requestAnimationFrame(renderPrediction);
}
Expand Down

0 comments on commit c7135ef

Please sign in to comment.