fix: add tracking + add new models
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -32,7 +32,6 @@ const GLOVE_CONFIGS: Record<
|
|||||||
|
|
||||||
const GLOVE_MODEL_SCALE = 0.33;
|
const GLOVE_MODEL_SCALE = 0.33;
|
||||||
const HAND_SPACE_DISTANCE = 0.5;
|
const HAND_SPACE_DISTANCE = 0.5;
|
||||||
const HAND_DEPTH_SCALE = 0.5;
|
|
||||||
const HAND_TRACKING_HIDE_DELAY_MS = 250;
|
const HAND_TRACKING_HIDE_DELAY_MS = 250;
|
||||||
|
|
||||||
const FINGER_LANDMARK_CHAINS = [
|
const FINGER_LANDMARK_CHAINS = [
|
||||||
@@ -126,12 +125,7 @@ function landmarkToWorldPoint(
|
|||||||
target.unproject(camera);
|
target.unproject(camera);
|
||||||
|
|
||||||
_direction.copy(target).sub(_cameraPosition).normalize();
|
_direction.copy(target).sub(_cameraPosition).normalize();
|
||||||
target
|
target.copy(_cameraPosition).addScaledVector(_direction, HAND_SPACE_DISTANCE);
|
||||||
.copy(_cameraPosition)
|
|
||||||
.addScaledVector(
|
|
||||||
_direction,
|
|
||||||
HAND_SPACE_DISTANCE - landmark.z * HAND_DEPTH_SCALE,
|
|
||||||
);
|
|
||||||
|
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,10 +25,7 @@ import { INTERACTION_RADIUS } from "@/data/interaction/interactionConfig";
|
|||||||
import { useDebugFolder } from "@/hooks/debug/useDebugFolder";
|
import { useDebugFolder } from "@/hooks/debug/useDebugFolder";
|
||||||
import { useHandTrackingSnapshot } from "@/hooks/handTracking/useHandTrackingSnapshot";
|
import { useHandTrackingSnapshot } from "@/hooks/handTracking/useHandTrackingSnapshot";
|
||||||
import { InteractionManager } from "@/managers/InteractionManager";
|
import { InteractionManager } from "@/managers/InteractionManager";
|
||||||
import type {
|
import type { HandTrackingHand } from "@/types/handTracking/handTracking";
|
||||||
HandTrackingHand,
|
|
||||||
HandTrackingLandmark,
|
|
||||||
} from "@/types/handTracking/handTracking";
|
|
||||||
import type { ColliderShape, Vector3Tuple } from "@/types/three/three";
|
import type { ColliderShape, Vector3Tuple } from "@/types/three/three";
|
||||||
|
|
||||||
interface GrabbableObjectProps {
|
interface GrabbableObjectProps {
|
||||||
@@ -44,6 +41,11 @@ interface GrabbableObjectProps {
|
|||||||
snapTargets?: readonly Vector3Tuple[];
|
snapTargets?: readonly Vector3Tuple[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface HandScreenPoint {
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
}
|
||||||
|
|
||||||
const grabDebugParams = {
|
const grabDebugParams = {
|
||||||
stiffness: GRAB_STIFFNESS_DEFAULT,
|
stiffness: GRAB_STIFFNESS_DEFAULT,
|
||||||
throwBoost: GRAB_THROW_BOOST_DEFAULT,
|
throwBoost: GRAB_THROW_BOOST_DEFAULT,
|
||||||
@@ -74,10 +76,10 @@ const HAND_HIT_OFFSETS: Array<[number, number]> = [
|
|||||||
[0, -HAND_GRAB_SCREEN_RADIUS],
|
[0, -HAND_GRAB_SCREEN_RADIUS],
|
||||||
];
|
];
|
||||||
|
|
||||||
function getHandCenterPoint(hand: HandTrackingHand): HandTrackingLandmark {
|
function getHandCenterPoint(hand: HandTrackingHand): HandScreenPoint {
|
||||||
const landmarks = hand.landmarks;
|
const landmarks = hand.landmarks;
|
||||||
if (landmarks.length === 0) {
|
if (landmarks.length === 0) {
|
||||||
return { x: hand.x, y: hand.y, z: hand.z };
|
return { x: hand.x, y: hand.y };
|
||||||
}
|
}
|
||||||
|
|
||||||
let minX = landmarks[0]!.x;
|
let minX = landmarks[0]!.x;
|
||||||
@@ -95,7 +97,6 @@ function getHandCenterPoint(hand: HandTrackingHand): HandTrackingLandmark {
|
|||||||
return {
|
return {
|
||||||
x: (minX + maxX) / 2,
|
x: (minX + maxX) / 2,
|
||||||
y: (minY + maxY) / 2,
|
y: (minY + maxY) / 2,
|
||||||
z: hand.z,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +104,7 @@ function getHandHit(
|
|||||||
group: THREE.Group | null,
|
group: THREE.Group | null,
|
||||||
camera: THREE.Camera,
|
camera: THREE.Camera,
|
||||||
cameraPos: THREE.Vector3,
|
cameraPos: THREE.Vector3,
|
||||||
handCenter: HandTrackingLandmark,
|
handCenter: HandScreenPoint,
|
||||||
): THREE.Intersection | null {
|
): THREE.Intersection | null {
|
||||||
if (!group) return null;
|
if (!group) return null;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user