UNPKG

@react-three/p2

Version:

2D physics based hooks for react-three-fiber

50 lines (49 loc) 1.39 kB
import type { Body, Constraint, ContactMaterial, Material, Spring, TopDownVehicle } from 'p2-es'; import { World } from 'p2-es'; import type { KinematicCharacterController, PlatformController } from '../Controllers'; import type { SubscriptionName, SubscriptionTarget } from '../setup'; import type { WithUUID } from './types'; interface DecoratedWorld extends World { bodies: WithUUID<Body>[]; constraints: WithUUID<Constraint>[]; contactMaterials: WithUUID<ContactMaterial>[]; } export interface State { bodies: { [uuid: string]: Body; }; bodiesNeedSyncing: boolean; constraints: { [uuid: string]: () => void; }; controllers: { [uuid: string]: { controller: KinematicCharacterController | PlatformController; }; }; materials: { [uuid: string]: Material; }; normal: [number, number, number]; normalIndex: number; rays: { [uuid: string]: () => void; }; springInstances: { [uuid: string]: Spring; }; springs: { [uuid: string]: () => void; }; subscriptions: { [id: string]: [uuid: string, type: SubscriptionName, target: SubscriptionTarget]; }; vehicles: { [uuid: string]: { vehicle: TopDownVehicle; }; }; world: DecoratedWorld; } export declare const state: State; export {};