export class Physics { /** * constructor(options) * - updateIntervalMs: number (default 16). setTimeout tick period on the main thread * - fixedDt: number seconds per physics step (default: updateIntervalMs/1000) * - gravity: [x,y,z] OR { mode:'vector', vector:[x,y,z] } OR { mode:'geocentric', planetCenter:[x,y,z], intensity:number } * - autoStart: boolean (default true) */ constructor(options?: {}); updateIntervalMs: any; fixedDt: any; gravity: { mode: string; vector: any[]; planetCenter?: undefined; intensity?: undefined; } | { mode: string; planetCenter: any[]; intensity: any; vector?: undefined; }; autoStart: boolean; sharedMemorySupported: boolean; worker: any; _msgId: number; _pending: Map; _onWorkerMessage(ev: any): void; helperWorker: any; _helperMsgId: number; _helperPending: Map; _onHelperMessage(ev: any): void; _paused: boolean; _lastTickTime: number; _lastState: any; _currentState: any; _interpolationMax: number; _nextBodyId: number; _nextColliderId: number; rigidBodies: Map; bodyToColliders: Map; colliderToBody: Map; _listeners: Map; _initPromise: Promise; /** * addObject({ object, type, mass, position, rotation, velocity, angularVelocity }) * - object: THREE.Object3D (e.g., OGC3DTile or any Object3D) * - type: 'dynamic' | 'kinematic' | 'fixed' (default 'dynamic') * - mass: number (default 1) * - position: array|Vector3 * - rotation: Euler|Quaternion|[x,y,z,w] * - velocity: array|Vector3 (optional) * - angularVelocity: array|Vector3 (optional) */ addObject(options?: {}): string; /** * attachTrimeshCollider({ bodyId, geometry?, positions?, indices?, localPosition?, localRotation?, localScale? }) => Promise * Creates a TRIMESH collider with baked non-uniform scale and attaches it to the body. * Positions/indices are always duplicated on the main thread and their ArrayBuffers are transferred. */ attachTrimeshCollider({ bodyId, geometry, positions, indices, localPosition, localRotation, localScale }: { bodyId: any; geometry: any; positions: any; indices: any; localPosition: any; localRotation: any; localScale: any; }): Promise | Promise; /** * addConvexHullCollider({ bodyId, geometry?, positions?, indices?, localPosition?, localRotation?, localScale? }) => Promise * Computes a convex hull in a helper worker (with non-uniform scale baked in) and attaches it as a collider. * Positions/indices are duplicated on the main thread and their ArrayBuffers are transferred to the helper worker. */ addConvexHullCollider({ bodyId, geometry, positions, indices, localPosition, localRotation, localScale }: { bodyId: any; geometry: any; positions: any; indices: any; localPosition: any; localRotation: any; localScale: any; }): Promise; /** * attachShapeCollider({ bodyId, shape, localPosition?, localRotation? }) => Promise * Creates a primitive/analytic collider (via engine-agnostic shape descriptor) and attaches it to the body. * Note: Any scale must be baked into the shape's parameters; no scale is applied at runtime. */ attachShapeCollider({ bodyId, shape, localPosition, localRotation }: { bodyId: any; shape: any; localPosition: any; localRotation: any; }): string | Promise; /** * detachCollider({ colliderId }) */ detachCollider({ colliderId }: { colliderId: any; }): void; /** * removeObject({ bodyId }) */ removeObject({ bodyId }: { bodyId: any; }): void; /** * applyForce({ bodyId, force, worldPoint?, wake = true, impulse = false, resetForces = false, resetTorques = false }) */ applyForce({ bodyId, force, worldPoint, wake, impulse, resetForces, resetTorques }: { bodyId: any; force: any; worldPoint: any; wake?: boolean | undefined; impulse?: boolean | undefined; resetForces?: boolean | undefined; resetTorques?: boolean | undefined; }): void; /** * applyForces({ bodyId, forces: [[x,y,z],...], worldPoints?: [ [x,y,z]|null ], wake=true, impulse=false, resetForces=false, resetTorques=false }) */ applyForces({ bodyId, forces, worldPoints, wake, impulse, resetForces, resetTorques }: { bodyId: any; forces: any; worldPoints: any; wake?: boolean | undefined; impulse?: boolean | undefined; resetForces?: boolean | undefined; resetTorques?: boolean | undefined; }): void; /** * applyTorque({ bodyId, torque, wake = true, impulse = false, resetTorques = false }) */ applyTorque({ bodyId, torque, wake, impulse, resetTorques }: { bodyId: any; torque: any; wake?: boolean | undefined; impulse?: boolean | undefined; resetTorques?: boolean | undefined; }): void; /** * applyTorques({ bodyId, torques: [[x,y,z],...], wake=true, impulse=false, resetTorques=false }) */ applyTorques({ bodyId, torques, wake, impulse, resetTorques }: { bodyId: any; torques: any; wake?: boolean | undefined; impulse?: boolean | undefined; resetTorques?: boolean | undefined; }): void; /** * setGravity(gravityOptions) */ setGravity(gravityOptions: any): void; /** * setPose({ bodyId, position?, rotation?, wake = true }) * Teleport a rigid body to a new pose immediately. * - position: [x,y,z] or THREE.Vector3 (optional) * - rotation: [x,y,z,w] or THREE.Quaternion/Euler (optional) * - wake: boolean (default true) */ setPose({ bodyId, position, rotation, wake }: { bodyId: any; position: any; rotation: any; wake?: boolean | undefined; }): void; /** * raycast({ origin, direction, maxToi = 1e6, filter? }) => Promise */ raycast({ origin, direction, maxToi, filter }: { origin: any; direction: any; maxToi?: number | undefined; filter: any; }): Promise; /** * pause / resume */ pause(): void; resume(): void; /** * setUpdateInterval(ms: number) */ setUpdateInterval(ms: any): void; /** * stepOnce(dtSeconds?: number) * Requests a single physics integration step on worker. */ stepOnce(dtSeconds: any): Promise; /** * update() * Interpolates between the last two physics snapshots and applies transforms to linked THREE.Object3D. * This is automatically called on a setTimeout loop by the constructor, but can also be called manually. */ update(): void; /** * dispose() * Terminates the worker and clears all registries. */ dispose(): void; _scheduleNextTick(): void; _onTick(): void; _ensureHelperWorker(): void; _helperPost(msg: any, transfer?: any[]): Promise; _post(msg: any, transfer?: any[]): Promise; on(type: any, fn: any): () => void; off(type: any, fn: any): void; _emit(type: any, payload: any): void; } export default Physics;