refactor: replace pinch gesture with fist gesture

This commit is contained in:
Tom Boullay
2026-04-29 10:34:11 +02:00
parent 3503ff52ed
commit d4dd0fa283
9 changed files with 69 additions and 26 deletions
+5 -5
View File
@@ -92,14 +92,14 @@ export function GrabbableObject({
useFrame(() => {
if (!rbRef.current) return;
const pinchingHand = handControlled
? hands.find((hand) => hand.isPinch)
const fistHand = handControlled
? hands.find((hand) => hand.isFist)
: undefined;
if (!isHolding.current && !pinchingHand) return;
if (!isHolding.current && !fistHand) return;
if (pinchingHand) {
_handNdc.set((1 - pinchingHand.x) * 2 - 1, -pinchingHand.y * 2 + 1, 0.5);
if (fistHand) {
_handNdc.set((1 - fistHand.x) * 2 - 1, -fistHand.y * 2 + 1, 0.5);
_handNdc.unproject(camera);
_handDirection.subVectors(_handNdc, camera.position).normalize();
_holdTarget