UNPKG

@osobh/reactar

Version:

AR Library for React Native and Expo

54 lines (53 loc) 1.42 kB
import { Vector3, Quaternion } from 'three'; import { PhysicsManager } from './PhysicsManager'; interface BoneConfig { name: string; dimensions: Vector3; position: Vector3; rotation: Quaternion; mass: number; parentBone?: string; jointType: 'hinge' | 'cone' | 'point'; jointLimits?: { minAngle?: Vector3; maxAngle?: Vector3; swingSpan1?: number; swingSpan2?: number; twistSpan?: number; }; } export declare class RagdollPhysics { private physicsManager; private bones; private isInitialized; constructor(physicsManager: PhysicsManager); /** * Creates a ragdoll from a configuration of bones */ createRagdoll(config: BoneConfig[]): void; /** * Creates a single bone rigid body */ private createBone; /** * Creates a constraint between two bones */ private createJointConstraint; /** * Applies an impulse force to a specific bone */ applyImpulse(boneName: string, impulse: Vector3, worldPoint?: Vector3): void; /** * Gets the current position and rotation of a bone */ getBoneTransform(boneName: string): { position: Vector3; rotation: Quaternion; }; /** * Cleans up physics resources for the ragdoll */ setKinematic(boneName: string, isKinematic: boolean): void; cleanup(): void; } export {};