import { MutableRefObject } from "react"; import { BufferGeometry, Mesh, Object3D, Quaternion, Vector3 } from "three"; import { BodyConfig, CommonConstraintConfig, DynamicConstraintConfig, RaycastHit, RaycastOptions, ShapeConfig, SharedBuffers, SingleBodyConstraintConfig, SoftBodyConfig, TwoBodyConstraintConfig, UpdateBodyOptions, UUID } from "../three-ammo/lib/types"; import { WorkerHelpers } from "../three-ammo/lib/worker-helper"; export interface PhysicsState { workerHelpers: ReturnType; debugGeometry: BufferGeometry; debugBuffer: SharedArrayBuffer | ArrayBuffer; bodyOptions: Record; uuids: UUID[]; object3Ds: Record; softBodies: Record; sharedBuffersRef: MutableRefObject; uuidToIndex: Record; debugIndex: Uint32Array; addRigidBody(uuid: UUID, mesh: Object3D, shape: ShapeDescriptor, options?: BodyConfig): any; removeRigidBody(uuid: UUID): any; addSoftBody(uuid: UUID, mesh: Object3D, options?: SoftBodyConfig): any; removeSoftBody(uuid: UUID): any; rayTest(options: RaycastOptions): Promise; } export interface PhysicsPerformanceInfo { lastTickMs: number; substepCounter: number; } export interface ShapeDescriptor { meshToUse: Object3D; shapeConfig?: ShapeConfig; } export interface AmmoPhysicsContext { addRigidBody(uuid: UUID, mesh: Object3D, shape: ShapeDescriptor, options?: BodyConfig): any; removeRigidBody(uuid: UUID): any; addSoftBody(uuid: UUID, mesh: Object3D, options?: SoftBodyConfig): any; removeSoftBody(uuid: string): any; addConstraint(constraintId: UUID, bodyUuid: UUID, targetUuid: undefined, options: SingleBodyConstraintConfig & CommonConstraintConfig): any; addConstraint(constraintId: UUID, bodyUuid: UUID, targetUuid: UUID, options: TwoBodyConstraintConfig & CommonConstraintConfig): any; updateConstraint(constraintId: UUID, options?: DynamicConstraintConfig): any; removeConstraint(constraintId: UUID): any; updateRigidBody(uuid: UUID, options: UpdateBodyOptions): any; enableDebug(enable: boolean, debugSharedArrayBuffer: SharedArrayBuffer): any; resetDynamicBody(uuid: UUID): any; activateBody(uuid: UUID): any; bodySetMotionState(uuid: UUID, position?: Vector3, rotation?: Quaternion): any; bodySetLinearVelocity(uuid: UUID, velocity: Vector3): any; bodyApplyImpulse(uuid: UUID, impulse: Vector3, relativeOffset?: Vector3): any; bodyApplyForce(uuid: UUID, force: Vector3, relativeOffset?: Vector3): any; bodySetShapesOffset(uuid: string, offset: Vector3): any; object3Ds: Record; rayTest(options: RaycastOptions): Promise; physicsPerformanceInfoRef: MutableRefObject; } export declare const AmmoPhysicsContext: import("react").Context; export declare function useAmmoPhysicsContext(): AmmoPhysicsContext;