@react-three/rapier 0.11.3 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,57 +1,56 @@
1
1
  import { Collider } from "@dimforge/rapier3d-compat";
2
2
  import React, { ReactNode } from "react";
3
- import { UseColliderOptions, CuboidArgs, RoundCuboidArgs, BallArgs, CapsuleArgs, HeightfieldArgs, TrimeshArgs, ConeArgs, CylinderArgs, ConvexHullArgs } from "./types";
4
- export interface ColliderProps extends UseColliderOptions<any> {
3
+ import { ColliderOptions, CuboidArgs, RoundCuboidArgs, BallArgs, CapsuleArgs, HeightfieldArgs, TrimeshArgs, ConeArgs, CylinderArgs, ConvexHullArgs } from "./types";
4
+ export interface ColliderProps extends ColliderOptions<any> {
5
5
  children?: ReactNode;
6
6
  }
7
7
  export declare const AnyCollider: React.MemoExoticComponent<React.ForwardRefExoticComponent<ColliderProps & React.RefAttributes<Collider[]>>>;
8
- declare type UseColliderOptionsRequiredArgs<T extends unknown[]> = Omit<UseColliderOptions<T>, "args"> & {
8
+ export declare type ColliderOptionsRequiredArgs<T extends unknown[]> = Omit<ColliderOptions<T>, "args"> & {
9
9
  args: T;
10
10
  children?: ReactNode;
11
11
  };
12
- export declare type CuboidColliderProps = UseColliderOptionsRequiredArgs<CuboidArgs>;
13
- export declare type RoundCuboidColliderProps = UseColliderOptionsRequiredArgs<RoundCuboidArgs>;
14
- export declare type BallColliderProps = UseColliderOptionsRequiredArgs<BallArgs>;
15
- export declare type CapsuleColliderProps = UseColliderOptionsRequiredArgs<CapsuleArgs>;
16
- export declare type HeightfieldColliderProps = UseColliderOptionsRequiredArgs<HeightfieldArgs>;
17
- export declare type TrimeshColliderProps = UseColliderOptionsRequiredArgs<TrimeshArgs>;
18
- export declare type ConeColliderProps = UseColliderOptionsRequiredArgs<ConeArgs>;
19
- export declare type CylinderColliderProps = UseColliderOptionsRequiredArgs<CylinderArgs>;
20
- export declare type ConvexHullColliderProps = UseColliderOptionsRequiredArgs<ConvexHullArgs>;
21
- export declare const CuboidCollider: React.ForwardRefExoticComponent<Omit<UseColliderOptions<CuboidArgs>, "args"> & {
12
+ export declare type CuboidColliderProps = ColliderOptionsRequiredArgs<CuboidArgs>;
13
+ export declare type RoundCuboidColliderProps = ColliderOptionsRequiredArgs<RoundCuboidArgs>;
14
+ export declare type BallColliderProps = ColliderOptionsRequiredArgs<BallArgs>;
15
+ export declare type CapsuleColliderProps = ColliderOptionsRequiredArgs<CapsuleArgs>;
16
+ export declare type HeightfieldColliderProps = ColliderOptionsRequiredArgs<HeightfieldArgs>;
17
+ export declare type TrimeshColliderProps = ColliderOptionsRequiredArgs<TrimeshArgs>;
18
+ export declare type ConeColliderProps = ColliderOptionsRequiredArgs<ConeArgs>;
19
+ export declare type CylinderColliderProps = ColliderOptionsRequiredArgs<CylinderArgs>;
20
+ export declare type ConvexHullColliderProps = ColliderOptionsRequiredArgs<ConvexHullArgs>;
21
+ export declare const CuboidCollider: React.ForwardRefExoticComponent<Omit<ColliderOptions<CuboidArgs>, "args"> & {
22
22
  args: CuboidArgs;
23
23
  children?: ReactNode;
24
24
  } & React.RefAttributes<Collider[]>>;
25
- export declare const RoundCuboidCollider: React.ForwardRefExoticComponent<Omit<UseColliderOptions<RoundCuboidArgs>, "args"> & {
25
+ export declare const RoundCuboidCollider: React.ForwardRefExoticComponent<Omit<ColliderOptions<RoundCuboidArgs>, "args"> & {
26
26
  args: RoundCuboidArgs;
27
27
  children?: ReactNode;
28
28
  } & React.RefAttributes<Collider[]>>;
29
- export declare const BallCollider: React.ForwardRefExoticComponent<Omit<UseColliderOptions<BallArgs>, "args"> & {
29
+ export declare const BallCollider: React.ForwardRefExoticComponent<Omit<ColliderOptions<BallArgs>, "args"> & {
30
30
  args: BallArgs;
31
31
  children?: ReactNode;
32
32
  } & React.RefAttributes<Collider[]>>;
33
- export declare const CapsuleCollider: React.ForwardRefExoticComponent<Omit<UseColliderOptions<CapsuleArgs>, "args"> & {
33
+ export declare const CapsuleCollider: React.ForwardRefExoticComponent<Omit<ColliderOptions<CapsuleArgs>, "args"> & {
34
34
  args: CapsuleArgs;
35
35
  children?: ReactNode;
36
36
  } & React.RefAttributes<Collider[]>>;
37
- export declare const HeightfieldCollider: React.ForwardRefExoticComponent<Omit<UseColliderOptions<HeightfieldArgs>, "args"> & {
37
+ export declare const HeightfieldCollider: React.ForwardRefExoticComponent<Omit<ColliderOptions<HeightfieldArgs>, "args"> & {
38
38
  args: HeightfieldArgs;
39
39
  children?: ReactNode;
40
40
  } & React.RefAttributes<Collider[]>>;
41
- export declare const TrimeshCollider: React.ForwardRefExoticComponent<Omit<UseColliderOptions<TrimeshArgs>, "args"> & {
41
+ export declare const TrimeshCollider: React.ForwardRefExoticComponent<Omit<ColliderOptions<TrimeshArgs>, "args"> & {
42
42
  args: TrimeshArgs;
43
43
  children?: ReactNode;
44
44
  } & React.RefAttributes<Collider[]>>;
45
- export declare const ConeCollider: React.ForwardRefExoticComponent<Omit<UseColliderOptions<ConeArgs>, "args"> & {
45
+ export declare const ConeCollider: React.ForwardRefExoticComponent<Omit<ColliderOptions<ConeArgs>, "args"> & {
46
46
  args: ConeArgs;
47
47
  children?: ReactNode;
48
48
  } & React.RefAttributes<Collider[]>>;
49
- export declare const CylinderCollider: React.ForwardRefExoticComponent<Omit<UseColliderOptions<CylinderArgs>, "args"> & {
49
+ export declare const CylinderCollider: React.ForwardRefExoticComponent<Omit<ColliderOptions<CylinderArgs>, "args"> & {
50
50
  args: CylinderArgs;
51
51
  children?: ReactNode;
52
52
  } & React.RefAttributes<Collider[]>>;
53
- export declare const ConvexHullCollider: React.ForwardRefExoticComponent<Omit<UseColliderOptions<ConvexHullArgs>, "args"> & {
53
+ export declare const ConvexHullCollider: React.ForwardRefExoticComponent<Omit<ColliderOptions<ConvexHullArgs>, "args"> & {
54
54
  args: ConvexHullArgs;
55
55
  children?: ReactNode;
56
56
  } & React.RefAttributes<Collider[]>>;
57
- export {};
@@ -2,8 +2,8 @@ import { InteractionGroups, RigidBody } from "@dimforge/rapier3d-compat";
2
2
  import { FC } from "react";
3
3
  import { Object3D } from "three";
4
4
  import { Object3DProps } from "@react-three/fiber";
5
- declare type GravityType = "static" | "linear" | "newtonian";
6
- interface AttractorProps {
5
+ export declare type AttractorGravityType = "static" | "linear" | "newtonian";
6
+ export interface AttractorProps {
7
7
  /**
8
8
  * The relative position of this attractor
9
9
  */
@@ -29,7 +29,7 @@ interface AttractorProps {
29
29
  * - newtonian: The gravity is calculated using the newtonian gravity formula.
30
30
  * @default "static"
31
31
  */
32
- type?: GravityType;
32
+ type?: AttractorGravityType;
33
33
  /**
34
34
  * The mass of the attractor. Used when type is `newtonian`.
35
35
  * @default 6.673e-11
@@ -48,4 +48,3 @@ export interface AttractorState extends Required<Omit<AttractorProps, "position"
48
48
  export declare type AttractorStateMap = Map<Object3D["uuid"], AttractorState>;
49
49
  export declare const applyAttractorForceOnRigidBody: (rigidBody: RigidBody, { object, strength, range, gravitationalConstant, collisionGroups, type }: AttractorState) => void;
50
50
  export declare const Attractor: FC<AttractorProps>;
51
- export {};
@@ -1,5 +1,2 @@
1
- import { FC } from "react";
2
- interface DebugProps {
3
- }
4
- export declare const Debug: FC<DebugProps>;
5
- export {};
1
+ import React from "react";
2
+ export declare const Debug: React.MemoExoticComponent<() => JSX.Element>;
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ /// <reference types="react" />
2
2
  import { InstancedRigidBodyApi } from "./api";
3
3
  import { RigidBodyProps } from "./RigidBody";
4
4
  import { Vector3Array } from "./types";
@@ -7,4 +7,4 @@ export interface InstancedRigidBodiesProps extends Omit<RigidBodyProps, "positio
7
7
  rotations?: Vector3Array[];
8
8
  scales?: Vector3Array[];
9
9
  }
10
- export declare const InstancedRigidBodies: React.ForwardRefExoticComponent<InstancedRigidBodiesProps & React.RefAttributes<InstancedRigidBodyApi>>;
10
+ export declare const InstancedRigidBodies: import("react").ForwardRefExoticComponent<InstancedRigidBodiesProps & import("react").RefAttributes<InstancedRigidBodyApi>>;
@@ -1,11 +1,7 @@
1
- import { ReactNode } from "react";
1
+ import React, { ReactNode } from "react";
2
2
  import { RigidBodyAutoCollider } from "./types";
3
- interface MeshColliderProps {
3
+ export interface MeshColliderProps {
4
4
  children: ReactNode;
5
5
  type: RigidBodyAutoCollider;
6
6
  }
7
- export declare const MeshCollider: {
8
- (props: MeshColliderProps): JSX.Element;
9
- displayName: string;
10
- };
11
- export {};
7
+ export declare const MeshCollider: React.MemoExoticComponent<(props: MeshColliderProps) => JSX.Element>;
@@ -2,7 +2,8 @@ import type Rapier from "@dimforge/rapier3d-compat";
2
2
  import { Collider, ColliderHandle, RigidBody, RigidBodyHandle } from "@dimforge/rapier3d-compat";
3
3
  import React, { FC, ReactNode } from "react";
4
4
  import { Matrix4, Object3D, Vector3 } from "three";
5
- import { CollisionEnterHandler, CollisionExitHandler, ContactForceHandler, IntersectionEnterHandler, IntersectionExitHandler, RigidBodyAutoCollider, Vector3Array, WorldApi } from "./types";
5
+ import { CollisionEnterHandler, CollisionExitHandler, ContactForceHandler, IntersectionEnterHandler, IntersectionExitHandler, RigidBodyAutoCollider, Vector3Array } from "./types";
6
+ import { WorldApi } from "./api";
6
7
  import { AttractorStateMap } from "./Attractor";
7
8
  export interface RigidBodyState {
8
9
  rigidBody: RigidBody;
@@ -17,6 +18,8 @@ export interface RigidBodyState {
17
18
  isSleeping: boolean;
18
19
  }
19
20
  export declare type RigidBodyStateMap = Map<RigidBody["handle"], RigidBodyState>;
21
+ export declare type WorldStepCallback = (worldApi: WorldApi) => void;
22
+ export declare type WorldStepCallbackSet = Set<WorldStepCallback>;
20
23
  export interface ColliderState {
21
24
  collider: Collider;
22
25
  object: Object3D;
@@ -28,31 +31,59 @@ export interface ColliderState {
28
31
  }
29
32
  export declare type ColliderStateMap = Map<Collider["handle"], ColliderState>;
30
33
  export interface RapierContext {
31
- rapier: typeof Rapier;
32
- world: WorldApi;
33
34
  /**
35
+ * Used by the world to keep track of RigidBody states
34
36
  * @internal
35
37
  */
36
38
  rigidBodyStates: RigidBodyStateMap;
37
39
  /**
40
+ * Used by the world to keep track of Collider states
38
41
  * @internal
39
42
  */
40
43
  colliderStates: ColliderStateMap;
41
44
  /**
45
+ * Used by the world to keep track of RigidBody events
42
46
  * @internal
43
47
  */
44
48
  rigidBodyEvents: EventMap;
45
49
  /**
50
+ * Used by the world to keep track of Collider events
46
51
  * @internal
47
52
  */
48
53
  colliderEvents: EventMap;
49
54
  /**
55
+ * Used by the world to keep track of Attractor states
50
56
  * @internal
51
57
  */
52
58
  attractorStates: AttractorStateMap;
59
+ /**
60
+ * Default options for rigid bodies and colliders
61
+ * @internal
62
+ */
53
63
  physicsOptions: {
54
64
  colliders: RigidBodyAutoCollider;
55
65
  };
66
+ /**
67
+ * Triggered before the physics world is stepped
68
+ * @internal
69
+ */
70
+ beforeStepCallbacks: WorldStepCallbackSet;
71
+ /**
72
+ * Triggered after the physics world is stepped
73
+ * @internal
74
+ */
75
+ afterStepCallbacks: WorldStepCallbackSet;
76
+ /**
77
+ * Direct access to the Rapier instance
78
+ */
79
+ rapier: typeof Rapier;
80
+ /**
81
+ * The Rapier physics world
82
+ */
83
+ world: WorldApi;
84
+ /**
85
+ * If the physics simulation is paused
86
+ */
56
87
  isPaused: boolean;
57
88
  /**
58
89
  * Step the physics world one step
@@ -66,7 +97,7 @@ export interface RapierContext {
66
97
  */
67
98
  step: (deltaTime: number) => void;
68
99
  }
69
- export declare const RapierContext: React.Context<RapierContext | undefined>;
100
+ export declare const rapierContext: React.Context<RapierContext | undefined>;
70
101
  export declare type EventMapValue = {
71
102
  onSleep?(): void;
72
103
  onWake?(): void;
@@ -77,7 +108,7 @@ export declare type EventMapValue = {
77
108
  onContactForce?: ContactForceHandler;
78
109
  };
79
110
  export declare type EventMap = Map<ColliderHandle | RigidBodyHandle, EventMapValue>;
80
- interface RapierWorldProps {
111
+ export interface PhysicsProps {
81
112
  children: ReactNode;
82
113
  /**
83
114
  * Set the gravity of the physics world
@@ -121,5 +152,4 @@ interface RapierWorldProps {
121
152
  **/
122
153
  interpolate?: boolean;
123
154
  }
124
- export declare const Physics: FC<RapierWorldProps>;
125
- export {};
155
+ export declare const Physics: FC<PhysicsProps>;
@@ -1,20 +1,20 @@
1
1
  import React, { MutableRefObject, RefObject } from "react";
2
2
  import { ReactNode } from "react";
3
3
  import { Object3D } from "three";
4
- import { InstancedRigidBodyApi } from "./api";
4
+ import { InstancedRigidBodyApi, RigidBodyApi } from "./api";
5
5
  import { InstancedRigidBodiesProps } from "./InstancedRigidBodies";
6
- import { RigidBodyApi, UseRigidBodyOptions } from "./types";
6
+ import { RigidBodyOptions } from "./types";
7
7
  export declare const RigidBodyContext: React.Context<{
8
8
  ref: RefObject<Object3D> | MutableRefObject<Object3D>;
9
9
  api: RigidBodyApi | InstancedRigidBodyApi;
10
- options: UseRigidBodyOptions | InstancedRigidBodiesProps;
10
+ options: RigidBodyOptions | InstancedRigidBodiesProps;
11
11
  }>;
12
12
  export declare const useRigidBodyContext: () => {
13
13
  ref: RefObject<Object3D> | MutableRefObject<Object3D>;
14
14
  api: RigidBodyApi | InstancedRigidBodyApi;
15
- options: UseRigidBodyOptions | InstancedRigidBodiesProps;
15
+ options: RigidBodyOptions | InstancedRigidBodiesProps;
16
16
  };
17
- export interface RigidBodyProps extends UseRigidBodyOptions {
17
+ export interface RigidBodyProps extends RigidBodyOptions {
18
18
  children?: ReactNode;
19
19
  }
20
- export declare const RigidBody: React.MemoExoticComponent<React.ForwardRefExoticComponent<RigidBodyProps & React.RefAttributes<import("./api").RigidBodyApi>>>;
20
+ export declare const RigidBody: React.MemoExoticComponent<React.ForwardRefExoticComponent<RigidBodyProps & React.RefAttributes<RigidBodyApi>>>;
@@ -1,14 +1,10 @@
1
1
  import { Collider, ColliderDesc, DebugRenderBuffers, ImpulseJoint, JointData, RigidBody, RigidBodyDesc, World } from "@dimforge/rapier3d-compat";
2
2
  import { Quaternion, Vector3 } from "three";
3
- import { RefGetter } from "./types";
4
- declare type Vector3Object = {
5
- x: number;
6
- y: number;
7
- z: number;
8
- };
3
+ import { RefGetter, Vector3Object } from "./types";
9
4
  export interface RigidBodyApi {
10
5
  /**
11
6
  * Get the raw RigidBody
7
+ * @see https://rapier.rs/javascript3d/classes/RigidBody.html
12
8
  */
13
9
  raw(): RigidBody;
14
10
  /**
@@ -144,6 +140,14 @@ export declare const createInstancedRigidBodiesApi: (bodiesGetter: RefGetter<{
144
140
  rigidBody: RigidBody;
145
141
  api: RigidBodyApi;
146
142
  }[]>) => InstancedRigidBodyApi;
143
+ export interface ColliderApi {
144
+ /**
145
+ * The Collider
146
+ * @see https://rapier.rs/javascript3d/classes/Collider.html
147
+ */
148
+ raw: () => Collider | undefined;
149
+ readonly handle: number;
150
+ }
147
151
  export declare const createColliderApi: (ref: RefGetter<Collider>) => {
148
152
  raw: () => Collider | undefined;
149
153
  readonly handle: number;
@@ -163,10 +167,13 @@ export interface WorldApi {
163
167
  debugRender(): DebugRenderBuffers;
164
168
  }
165
169
  export declare const createWorldApi: (ref: RefGetter<World>) => WorldApi;
166
- export declare const createJointApi: (ref: RefGetter<ImpulseJoint>) => {
170
+ export interface JointApi {
171
+ /**
172
+ * @see https://rapier.rs/javascript3d/classes/ImpulseJoint.html
173
+ */
167
174
  raw: () => ImpulseJoint | undefined;
168
175
  readonly handle: number;
169
176
  configureMotorPosition: (targetPos: number, stiffness: number, damping: number) => void;
170
177
  configureMotorVelocity: (targetVel: number, damping: number) => void;
171
- };
172
- export {};
178
+ }
179
+ export declare const createJointApi: (ref: RefGetter<ImpulseJoint>) => JointApi;
@@ -1,41 +1,11 @@
1
1
  import React, { MutableRefObject } from "react";
2
- import { RapierContext } from "./Physics";
2
+ import { RapierContext, WorldStepCallback } from "./Physics";
3
3
  import { Object3D } from "three";
4
- import type Rapier from "@dimforge/rapier3d-compat";
5
- export declare const useRapier: () => RapierContext;
6
- import { UseRigidBodyOptions, UseImpulseJoint, SphericalJointParams, FixedJointParams, PrismaticJointParams, RevoluteJointParams, RigidBodyApi, RigidBodyApiRef } from "./types";
4
+ import { RigidBodyOptions } from "./types";
7
5
  import { ColliderProps, RigidBodyProps } from ".";
6
+ import { RigidBodyApi } from "./api";
7
+ export declare const useRapier: () => RapierContext;
8
+ export declare const useBeforePhysicsStep: (callback: WorldStepCallback) => void;
9
+ export declare const useAfterPhysicsStep: (callback: WorldStepCallback) => void;
8
10
  export declare const useChildColliderProps: <O extends Object3D<import("three").Event>>(ref: React.MutableRefObject<O | null | undefined>, options: RigidBodyProps, ignoreMeshColliders?: boolean) => ColliderProps[];
9
- export declare const useRigidBody: <O extends Object3D<import("three").Event>>(options?: UseRigidBodyOptions) => [React.MutableRefObject<O>, import("./api").RigidBodyApi, ColliderProps[]];
10
- export declare const useImpulseJoint: <T extends Rapier.ImpulseJoint>(body1: RigidBodyApiRef, body2: RigidBodyApiRef, params: Rapier.JointData) => {
11
- raw: () => Rapier.ImpulseJoint | undefined;
12
- readonly handle: number;
13
- configureMotorPosition: (targetPos: number, stiffness: number, damping: number) => void;
14
- configureMotorVelocity: (targetVel: number, damping: number) => void;
15
- };
16
- /**
17
- *
18
- * A fixed joint ensures that two rigid-bodies don't move relative to each other.
19
- * Fixed joints are characterized by one local frame (represented by an isometry) on each rigid-body.
20
- * The fixed-joint makes these frames coincide in world-space.
21
- */
22
- export declare const useFixedJoint: UseImpulseJoint<FixedJointParams>;
23
- /**
24
- * The spherical joint ensures that two points on the local-spaces of two rigid-bodies always coincide (it prevents any relative
25
- * translational motion at this points). This is typically used to simulate ragdolls arms, pendulums, etc.
26
- * They are characterized by one local anchor on each rigid-body. Each anchor represents the location of the
27
- * points that need to coincide on the local-space of each rigid-body.
28
- */
29
- export declare const useSphericalJoint: UseImpulseJoint<SphericalJointParams>;
30
- /**
31
- * The revolute joint prevents any relative movement between two rigid-bodies, except for relative
32
- * rotations along one axis. This is typically used to simulate wheels, fans, etc.
33
- * They are characterized by one local anchor as well as one local axis on each rigid-body.
34
- */
35
- export declare const useRevoluteJoint: UseImpulseJoint<RevoluteJointParams>;
36
- /**
37
- * The prismatic joint prevents any relative movement between two rigid-bodies, except for relative translations along one axis.
38
- * It is characterized by one local anchor as well as one local axis on each rigid-body. In 3D, an optional
39
- * local tangent axis can be specified for each rigid-body.
40
- */
41
- export declare const usePrismaticJoint: UseImpulseJoint<PrismaticJointParams>;
11
+ export declare const useRigidBody: <O extends Object3D<import("three").Event>>(options?: RigidBodyOptions) => [React.MutableRefObject<O>, RigidBodyApi, ColliderProps[]];
@@ -1,8 +1,11 @@
1
1
  export * from "./types";
2
- export type { RigidBodyApi, WorldApi, InstancedRigidBodyApi } from "./api";
3
2
  export type { RigidBodyProps } from "./RigidBody";
4
3
  export type { InstancedRigidBodiesProps } from "./InstancedRigidBodies";
5
- export type { CylinderColliderProps, BallColliderProps, CapsuleColliderProps, ConeColliderProps, ConvexHullColliderProps, CuboidColliderProps, HeightfieldColliderProps, RoundCuboidColliderProps, TrimeshColliderProps } from "./AnyCollider";
4
+ export type { CylinderColliderProps, BallColliderProps, CapsuleColliderProps, ConeColliderProps, ConvexHullColliderProps, CuboidColliderProps, HeightfieldColliderProps, RoundCuboidColliderProps, TrimeshColliderProps, ColliderOptionsRequiredArgs } from "./AnyCollider";
5
+ export type { PhysicsProps, RapierContext, WorldStepCallback } from "./Physics";
6
+ export type { MeshColliderProps } from "./MeshCollider";
7
+ export type { AttractorProps, AttractorGravityType } from "./Attractor";
8
+ export type { RigidBodyApi, InstancedRigidBodyApi, JointApi, WorldApi } from "./api";
6
9
  export { Physics } from "./Physics";
7
10
  export { RigidBody } from "./RigidBody";
8
11
  export { MeshCollider } from "./MeshCollider";
@@ -10,5 +13,6 @@ export { Debug } from "./Debug";
10
13
  export { InstancedRigidBodies } from "./InstancedRigidBodies";
11
14
  export * from "./AnyCollider";
12
15
  export { Attractor } from "./Attractor";
13
- export * from "./hooks";
16
+ export * from "./joints";
17
+ export { useRapier, useBeforePhysicsStep, useAfterPhysicsStep } from "./hooks";
14
18
  export * from "./interaction-groups";
@@ -0,0 +1,30 @@
1
+ import { ImpulseJoint } from "@dimforge/rapier3d-compat";
2
+ import { RigidBodyApiRef, UseImpulseJoint, FixedJointParams, SphericalJointParams, RevoluteJointParams, PrismaticJointParams } from ".";
3
+ import type Rapier from "@dimforge/rapier3d-compat";
4
+ export declare const useImpulseJoint: <T extends ImpulseJoint>(body1: RigidBodyApiRef, body2: RigidBodyApiRef, params: Rapier.JointData) => import("./api").JointApi;
5
+ /**
6
+ *
7
+ * A fixed joint ensures that two rigid-bodies don't move relative to each other.
8
+ * Fixed joints are characterized by one local frame (represented by an isometry) on each rigid-body.
9
+ * The fixed-joint makes these frames coincide in world-space.
10
+ */
11
+ export declare const useFixedJoint: UseImpulseJoint<FixedJointParams>;
12
+ /**
13
+ * The spherical joint ensures that two points on the local-spaces of two rigid-bodies always coincide (it prevents any relative
14
+ * translational motion at this points). This is typically used to simulate ragdolls arms, pendulums, etc.
15
+ * They are characterized by one local anchor on each rigid-body. Each anchor represents the location of the
16
+ * points that need to coincide on the local-space of each rigid-body.
17
+ */
18
+ export declare const useSphericalJoint: UseImpulseJoint<SphericalJointParams>;
19
+ /**
20
+ * The revolute joint prevents any relative movement between two rigid-bodies, except for relative
21
+ * rotations along one axis. This is typically used to simulate wheels, fans, etc.
22
+ * They are characterized by one local anchor as well as one local axis on each rigid-body.
23
+ */
24
+ export declare const useRevoluteJoint: UseImpulseJoint<RevoluteJointParams>;
25
+ /**
26
+ * The prismatic joint prevents any relative movement between two rigid-bodies, except for relative translations along one axis.
27
+ * It is characterized by one local anchor as well as one local axis on each rigid-body. In 3D, an optional
28
+ * local tangent axis can be specified for each rigid-body.
29
+ */
30
+ export declare const usePrismaticJoint: UseImpulseJoint<PrismaticJointParams>;
@@ -4,7 +4,7 @@ import { Rotation, Vector } from "@dimforge/rapier3d-compat/math";
4
4
  import { Object3DProps } from "@react-three/fiber";
5
5
  import { Object3D } from "three";
6
6
  import { ColliderProps } from ".";
7
- import { createColliderApi, createJointApi, createRigidBodyApi, createWorldApi } from "./api";
7
+ import { RigidBodyApi, JointApi } from "./api";
8
8
  export { CoefficientCombineRule as CoefficientCombineRule } from "@dimforge/rapier3d-compat";
9
9
  export { RapierRigidBody, RapierCollider };
10
10
  export declare type RefGetter<T> = MutableRefObject<() => T | undefined>;
@@ -68,13 +68,18 @@ export declare type RoundConvexMeshArgs = [
68
68
  indices: ArrayLike<number>,
69
69
  borderRadius: number
70
70
  ];
71
- export declare type UseBodyOptions = Omit<UseRigidBodyOptions, "shape">;
71
+ export declare type UseBodyOptions = Omit<RigidBodyOptions, "shape">;
72
72
  export declare type RigidBodyTypeString = "fixed" | "dynamic" | "kinematicPosition" | "kinematicVelocity";
73
73
  export declare type ColliderShape = "cuboid" | "trimesh" | "ball" | "capsule" | "convexHull" | "heightfield" | "polyline" | "roundCuboid" | "cylinder" | "roundCylinder" | "cone" | "roundCone" | "convexMesh" | "roundConvexHull" | "roundConvexMesh";
74
74
  export declare type Vector3Array = [x: number, y: number, z: number];
75
75
  export declare type Vector4Array = [x: number, y: number, z: number, w: number];
76
76
  export declare type Boolean3Array = [x: boolean, y: boolean, z: boolean];
77
- export interface UseColliderOptions<ColliderArgs extends Array<unknown>> {
77
+ export declare type Vector3Object = {
78
+ x: number;
79
+ y: number;
80
+ z: number;
81
+ };
82
+ export interface ColliderOptions<ColliderArgs extends Array<unknown>> {
78
83
  /**
79
84
  * The optional name passed to THREE's Object3D
80
85
  */
@@ -222,7 +227,7 @@ export declare type CollisionExitHandler = (payload: CollisionExitPayload) => vo
222
227
  export declare type IntersectionEnterHandler = (payload: IntersectionEnterPayload) => void;
223
228
  export declare type IntersectionExitHandler = (payload: IntersectionExitPayload) => void;
224
229
  export declare type ContactForceHandler = (payload: ContactForcePayload) => void;
225
- export interface UseRigidBodyOptions extends ColliderProps {
230
+ export interface RigidBodyOptions extends ColliderProps {
226
231
  /**
227
232
  * Specify the type of this rigid body
228
233
  */
@@ -346,7 +351,3 @@ export declare type RigidBodyApiRef = MutableRefObject<undefined | null | RigidB
346
351
  export interface UseImpulseJoint<P> {
347
352
  (body1: RigidBodyApiRef, body2: RigidBodyApiRef, params: P): JointApi;
348
353
  }
349
- export declare type RigidBodyApi = ReturnType<typeof createRigidBodyApi>;
350
- export declare type ColliderApi = ReturnType<typeof createColliderApi>;
351
- export declare type WorldApi = ReturnType<typeof createWorldApi>;
352
- export declare type JointApi = ReturnType<typeof createJointApi>;