///
import type { AtomicName, AtomicProps, BodyProps, BoxProps, CompoundBodyProps, ConeTwistConstraintOpts, ContactMaterialOptions, ConvexPolyhedronProps, CylinderProps, DistanceConstraintOpts, HeightfieldProps, HingeConstraintOpts, LockConstraintOpts, MaterialOptions, ParticleProps, PlaneProps, PointToPointConstraintOpts, Quad, RayhitEvent, RayOptions, SphereProps, SpringOptns, TrimeshProps, Triplet, VectorName, WheelInfoOptions } from '@pmndrs/cannon-worker-api';
import type { DependencyList, Ref, RefObject } from 'react';
import { Euler, Object3D, Quaternion, Vector3 } from 'three';
export declare type AtomicApi = {
set: (value: AtomicProps[K]) => void;
subscribe: (callback: (value: AtomicProps[K]) => void) => () => void;
};
export declare type QuaternionApi = {
copy: ({ w, x, y, z }: Quaternion) => void;
set: (x: number, y: number, z: number, w: number) => void;
subscribe: (callback: (value: Quad) => void) => () => void;
};
export declare type VectorApi = {
copy: ({ x, y, z }: Vector3 | Euler) => void;
set: (x: number, y: number, z: number) => void;
subscribe: (callback: (value: Triplet) => void) => () => void;
};
export declare type WorkerApi = {
[K in AtomicName]: AtomicApi;
} & {
[K in VectorName]: VectorApi;
} & {
applyForce: (force: Triplet, worldPoint: Triplet) => void;
applyImpulse: (impulse: Triplet, worldPoint: Triplet) => void;
applyLocalForce: (force: Triplet, localPoint: Triplet) => void;
applyLocalImpulse: (impulse: Triplet, localPoint: Triplet) => void;
applyTorque: (torque: Triplet) => void;
quaternion: QuaternionApi;
rotation: VectorApi;
scaleOverride: (scale: Triplet) => void;
sleep: () => void;
wakeUp: () => void;
};
export interface PublicApi extends WorkerApi {
at: (index: number) => WorkerApi;
}
export declare type Api = [RefObject, PublicApi];
declare type GetByIndex = (index: number) => T;
export declare function usePlane(fn: GetByIndex, fwdRef?: Ref, deps?: DependencyList): Api;
export declare function useBox(fn: GetByIndex, fwdRef?: Ref, deps?: DependencyList): Api;
export declare function useCylinder(fn: GetByIndex, fwdRef?: Ref, deps?: DependencyList): Api;
export declare function useHeightfield(fn: GetByIndex, fwdRef?: Ref, deps?: DependencyList): Api;
export declare function useParticle(fn: GetByIndex, fwdRef?: Ref, deps?: DependencyList): Api;
export declare function useSphere(fn: GetByIndex, fwdRef?: Ref, deps?: DependencyList): Api;
export declare function useTrimesh(fn: GetByIndex, fwdRef?: Ref, deps?: DependencyList): Api;
export declare function useConvexPolyhedron(fn: GetByIndex, fwdRef?: Ref, deps?: DependencyList): Api;
export declare function useCompoundBody(fn: GetByIndex, fwdRef?: Ref, deps?: DependencyList): Api;
declare type ConstraintApi = [
RefObject,
RefObject,
{
disable: () => void;
enable: () => void;
}
];
declare type HingeConstraintApi = [
RefObject,
RefObject,
{
disable: () => void;
disableMotor: () => void;
enable: () => void;
enableMotor: () => void;
setMotorMaxForce: (value: number) => void;
setMotorSpeed: (value: number) => void;
}
];
declare type SpringApi = [
RefObject,
RefObject,
{
setDamping: (value: number) => void;
setRestLength: (value: number) => void;
setStiffness: (value: number) => void;
}
];
export declare function usePointToPointConstraint(bodyA: Ref | undefined, bodyB: Ref | undefined, optns: PointToPointConstraintOpts, deps?: DependencyList): ConstraintApi;
export declare function useConeTwistConstraint(bodyA: Ref | undefined, bodyB: Ref | undefined, optns: ConeTwistConstraintOpts, deps?: DependencyList): ConstraintApi;
export declare function useDistanceConstraint(bodyA: Ref | undefined, bodyB: Ref | undefined, optns: DistanceConstraintOpts, deps?: DependencyList): ConstraintApi;
export declare function useHingeConstraint(bodyA: Ref | undefined, bodyB: Ref | undefined, optns: HingeConstraintOpts, deps?: DependencyList): HingeConstraintApi;
export declare function useLockConstraint(bodyA: Ref | undefined, bodyB: Ref | undefined, optns: LockConstraintOpts, deps?: DependencyList): ConstraintApi;
export declare function useSpring(bodyA: Ref | undefined, bodyB: Ref | undefined, optns: SpringOptns, deps?: DependencyList): SpringApi;
export declare function useRaycastClosest(options: RayOptions, callback: (e: RayhitEvent) => void, deps?: DependencyList): void;
export declare function useRaycastAny(options: RayOptions, callback: (e: RayhitEvent) => void, deps?: DependencyList): void;
export declare function useRaycastAll(options: RayOptions, callback: (e: RayhitEvent) => void, deps?: DependencyList): void;
export interface RaycastVehiclePublicApi {
applyEngineForce: (value: number, wheelIndex: number) => void;
setBrake: (brake: number, wheelIndex: number) => void;
setSteeringValue: (value: number, wheelIndex: number) => void;
sliding: {
subscribe: (callback: (sliding: boolean) => void) => void;
};
}
export interface RaycastVehicleProps {
chassisBody: Ref;
indexForwardAxis?: number;
indexRightAxis?: number;
indexUpAxis?: number;
wheelInfos: WheelInfoOptions[];
wheels: Ref[];
}
export declare function useRaycastVehicle(fn: () => RaycastVehicleProps, fwdRef?: Ref, deps?: DependencyList): [RefObject, RaycastVehiclePublicApi];
export declare function useContactMaterial(materialA: MaterialOptions, materialB: MaterialOptions, options: ContactMaterialOptions, deps?: DependencyList): void;
export {};