@react-three/rapier 1.5.0 → 2.0.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.
- package/dist/declarations/src/components/AnyCollider.d.ts +16 -16
- package/dist/declarations/src/components/InstancedRigidBodies.d.ts +5 -4
- package/dist/declarations/src/components/Physics.d.ts +6 -6
- package/dist/declarations/src/components/RigidBody.d.ts +8 -10
- package/dist/declarations/src/hooks/hooks.d.ts +2 -2
- package/dist/declarations/src/hooks/joints.d.ts +1 -1
- package/dist/declarations/src/types.d.ts +52 -64
- package/dist/declarations/src/utils/interaction-groups.d.ts +1 -1
- package/dist/react-three-rapier.cjs.dev.js +199 -189
- package/dist/react-three-rapier.cjs.prod.js +199 -189
- package/dist/react-three-rapier.esm.js +200 -190
- package/package.json +14 -13
@@ -1,20 +1,20 @@
|
|
1
1
|
import { Collider } from "@dimforge/rapier3d-compat";
|
2
|
-
import React, { ReactNode } from "react";
|
3
|
-
import {
|
4
|
-
import { RoundConeArgs } from "../types.js";
|
2
|
+
import React, { ReactNode, Ref } from "react";
|
3
|
+
import { BallArgs, CapsuleArgs, ColliderOptions, ConeArgs, ConvexHullArgs, CuboidArgs, CylinderArgs, HeightfieldArgs, RoundConeArgs, RoundCuboidArgs, RoundCylinderArgs, TrimeshArgs } from "../types.js";
|
5
4
|
export interface ColliderProps extends ColliderOptions<any> {
|
6
5
|
children?: ReactNode;
|
6
|
+
ref?: Ref<Collider>;
|
7
7
|
}
|
8
8
|
/**
|
9
9
|
* A collider is a shape that can be attached to a rigid body to define its physical properties.
|
10
10
|
* @internal
|
11
11
|
*/
|
12
|
-
export declare const AnyCollider: React.MemoExoticComponent<
|
13
|
-
export
|
12
|
+
export declare const AnyCollider: React.MemoExoticComponent<(props: ColliderProps) => import("react/jsx-runtime").JSX.Element>;
|
13
|
+
export type ColliderOptionsRequiredArgs<T extends unknown[]> = Omit<ColliderOptions<T>, "args"> & {
|
14
14
|
args: T;
|
15
15
|
children?: ReactNode;
|
16
16
|
};
|
17
|
-
export
|
17
|
+
export type CuboidColliderProps = ColliderOptionsRequiredArgs<CuboidArgs>;
|
18
18
|
/**
|
19
19
|
* A cuboid collider shape
|
20
20
|
* @category Colliders
|
@@ -23,7 +23,7 @@ export declare const CuboidCollider: React.ForwardRefExoticComponent<Omit<Collid
|
|
23
23
|
args: CuboidArgs;
|
24
24
|
children?: ReactNode;
|
25
25
|
} & React.RefAttributes<Collider>>;
|
26
|
-
export
|
26
|
+
export type RoundCuboidColliderProps = ColliderOptionsRequiredArgs<RoundCuboidArgs>;
|
27
27
|
/**
|
28
28
|
* A round cuboid collider shape
|
29
29
|
* @category Colliders
|
@@ -32,7 +32,7 @@ export declare const RoundCuboidCollider: React.ForwardRefExoticComponent<Omit<C
|
|
32
32
|
args: RoundCuboidArgs;
|
33
33
|
children?: ReactNode;
|
34
34
|
} & React.RefAttributes<Collider>>;
|
35
|
-
export
|
35
|
+
export type BallColliderProps = ColliderOptionsRequiredArgs<BallArgs>;
|
36
36
|
/**
|
37
37
|
* A ball collider shape
|
38
38
|
* @category Colliders
|
@@ -41,7 +41,7 @@ export declare const BallCollider: React.ForwardRefExoticComponent<Omit<Collider
|
|
41
41
|
args: BallArgs;
|
42
42
|
children?: ReactNode;
|
43
43
|
} & React.RefAttributes<Collider>>;
|
44
|
-
export
|
44
|
+
export type CapsuleColliderProps = ColliderOptionsRequiredArgs<CapsuleArgs>;
|
45
45
|
/**
|
46
46
|
* A capsule collider shape
|
47
47
|
* @category Colliders
|
@@ -50,7 +50,7 @@ export declare const CapsuleCollider: React.ForwardRefExoticComponent<Omit<Colli
|
|
50
50
|
args: CapsuleArgs;
|
51
51
|
children?: ReactNode;
|
52
52
|
} & React.RefAttributes<Collider>>;
|
53
|
-
export
|
53
|
+
export type HeightfieldColliderProps = ColliderOptionsRequiredArgs<HeightfieldArgs>;
|
54
54
|
/**
|
55
55
|
* A heightfield collider shape
|
56
56
|
* @category Colliders
|
@@ -59,7 +59,7 @@ export declare const HeightfieldCollider: React.ForwardRefExoticComponent<Omit<C
|
|
59
59
|
args: HeightfieldArgs;
|
60
60
|
children?: ReactNode;
|
61
61
|
} & React.RefAttributes<Collider>>;
|
62
|
-
export
|
62
|
+
export type TrimeshColliderProps = ColliderOptionsRequiredArgs<TrimeshArgs>;
|
63
63
|
/**
|
64
64
|
* A trimesh collider shape
|
65
65
|
* @category Colliders
|
@@ -68,7 +68,7 @@ export declare const TrimeshCollider: React.ForwardRefExoticComponent<Omit<Colli
|
|
68
68
|
args: TrimeshArgs;
|
69
69
|
children?: ReactNode;
|
70
70
|
} & React.RefAttributes<Collider>>;
|
71
|
-
export
|
71
|
+
export type ConeColliderProps = ColliderOptionsRequiredArgs<ConeArgs>;
|
72
72
|
/**
|
73
73
|
* A cone collider shape
|
74
74
|
* @category Colliders
|
@@ -77,7 +77,7 @@ export declare const ConeCollider: React.ForwardRefExoticComponent<Omit<Collider
|
|
77
77
|
args: ConeArgs;
|
78
78
|
children?: ReactNode;
|
79
79
|
} & React.RefAttributes<Collider>>;
|
80
|
-
export
|
80
|
+
export type RoundConeColliderProps = ColliderOptionsRequiredArgs<RoundConeArgs>;
|
81
81
|
/**
|
82
82
|
* A round cylinder collider shape
|
83
83
|
* @category Colliders
|
@@ -86,7 +86,7 @@ export declare const RoundConeCollider: React.ForwardRefExoticComponent<Omit<Col
|
|
86
86
|
args: RoundConeArgs;
|
87
87
|
children?: ReactNode;
|
88
88
|
} & React.RefAttributes<Collider>>;
|
89
|
-
export
|
89
|
+
export type CylinderColliderProps = ColliderOptionsRequiredArgs<CylinderArgs>;
|
90
90
|
/**
|
91
91
|
* A cylinder collider shape
|
92
92
|
* @category Colliders
|
@@ -95,7 +95,7 @@ export declare const CylinderCollider: React.ForwardRefExoticComponent<Omit<Coll
|
|
95
95
|
args: CylinderArgs;
|
96
96
|
children?: ReactNode;
|
97
97
|
} & React.RefAttributes<Collider>>;
|
98
|
-
export
|
98
|
+
export type RoundCylinderColliderProps = ColliderOptionsRequiredArgs<RoundCylinderArgs>;
|
99
99
|
/**
|
100
100
|
* A round cylinder collider shape
|
101
101
|
* @category Colliders
|
@@ -104,7 +104,7 @@ export declare const RoundCylinderCollider: React.ForwardRefExoticComponent<Omit
|
|
104
104
|
args: RoundConeArgs;
|
105
105
|
children?: ReactNode;
|
106
106
|
} & React.RefAttributes<Collider>>;
|
107
|
-
export
|
107
|
+
export type ConvexHullColliderProps = ColliderOptionsRequiredArgs<ConvexHullArgs>;
|
108
108
|
/**
|
109
109
|
* A convex hull collider shape
|
110
110
|
* @category Colliders
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import React, { ReactNode } from "react";
|
2
|
-
import { RigidBodyProps } from "./RigidBody.js";
|
3
2
|
import { RapierRigidBody } from "../types.js";
|
4
|
-
|
3
|
+
import { RigidBodyProps } from "./RigidBody.js";
|
4
|
+
export type InstancedRigidBodyProps = RigidBodyProps & {
|
5
5
|
key: string | number;
|
6
6
|
};
|
7
|
-
export interface InstancedRigidBodiesProps extends RigidBodyProps {
|
7
|
+
export interface InstancedRigidBodiesProps extends Omit<RigidBodyProps, "ref"> {
|
8
8
|
instances: InstancedRigidBodyProps[];
|
9
9
|
colliderNodes?: ReactNode[];
|
10
10
|
children: ReactNode;
|
11
|
+
ref?: React.Ref<(RapierRigidBody | null)[] | null>;
|
11
12
|
}
|
12
|
-
export declare const InstancedRigidBodies: React.MemoExoticComponent<
|
13
|
+
export declare const InstancedRigidBodies: React.MemoExoticComponent<({ ref, ...props }: InstancedRigidBodiesProps) => import("react/jsx-runtime").JSX.Element>;
|
@@ -16,9 +16,9 @@ export interface RigidBodyState {
|
|
16
16
|
scale: Vector3;
|
17
17
|
isSleeping: boolean;
|
18
18
|
}
|
19
|
-
export
|
20
|
-
export
|
21
|
-
export
|
19
|
+
export type RigidBodyStateMap = Map<RigidBody["handle"], RigidBodyState>;
|
20
|
+
export type WorldStepCallback = (world: World) => void;
|
21
|
+
export type WorldStepCallbackSet = Set<{
|
22
22
|
current: WorldStepCallback;
|
23
23
|
}>;
|
24
24
|
export interface ColliderState {
|
@@ -30,7 +30,7 @@ export interface ColliderState {
|
|
30
30
|
*/
|
31
31
|
worldParent?: Object3D;
|
32
32
|
}
|
33
|
-
export
|
33
|
+
export type ColliderStateMap = Map<Collider["handle"], ColliderState>;
|
34
34
|
export interface RapierContext {
|
35
35
|
/**
|
36
36
|
* Used by the world to keep track of RigidBody states
|
@@ -131,7 +131,7 @@ export interface RapierContext {
|
|
131
131
|
isDebug: boolean;
|
132
132
|
}
|
133
133
|
export declare const rapierContext: React.Context<RapierContext | undefined>;
|
134
|
-
export
|
134
|
+
export type EventMapValue = {
|
135
135
|
onSleep?(): void;
|
136
136
|
onWake?(): void;
|
137
137
|
onCollisionEnter?: CollisionEnterHandler;
|
@@ -140,7 +140,7 @@ export declare type EventMapValue = {
|
|
140
140
|
onIntersectionExit?: IntersectionExitHandler;
|
141
141
|
onContactForce?: ContactForceHandler;
|
142
142
|
};
|
143
|
-
export
|
143
|
+
export type EventMap = Map<ColliderHandle | RigidBodyHandle, EventMapValue>;
|
144
144
|
export interface PhysicsProps {
|
145
145
|
children: ReactNode;
|
146
146
|
/**
|
@@ -1,22 +1,20 @@
|
|
1
|
-
import React, {
|
2
|
-
import { ReactNode } from "react";
|
1
|
+
import React, { ReactNode, Ref, RefObject } from "react";
|
3
2
|
import { Object3D } from "three";
|
4
3
|
import { RapierRigidBody, RigidBodyOptions } from "../types.js";
|
5
|
-
|
6
|
-
ref: RefObject<Object3D
|
7
|
-
getRigidBody: () => RapierRigidBody;
|
8
|
-
options: RigidBodyOptions;
|
9
|
-
}>;
|
10
|
-
export declare const useRigidBodyContext: () => {
|
11
|
-
ref: RefObject<Object3D> | MutableRefObject<Object3D>;
|
4
|
+
type RigidBodyContextType = {
|
5
|
+
ref: RefObject<Object3D>;
|
12
6
|
getRigidBody: () => RapierRigidBody;
|
13
7
|
options: RigidBodyOptions;
|
14
8
|
};
|
9
|
+
export declare const RigidBodyContext: React.Context<RigidBodyContextType>;
|
10
|
+
export declare const useRigidBodyContext: () => RigidBodyContextType;
|
15
11
|
export interface RigidBodyProps extends RigidBodyOptions {
|
16
12
|
children?: ReactNode;
|
13
|
+
ref?: Ref<RapierRigidBody>;
|
17
14
|
}
|
18
15
|
/**
|
19
16
|
* A rigid body is a physical object that can be simulated by the physics engine.
|
20
17
|
* @category Components
|
21
18
|
*/
|
22
|
-
export declare const RigidBody: React.MemoExoticComponent<
|
19
|
+
export declare const RigidBody: React.MemoExoticComponent<(props: RigidBodyProps) => import("react/jsx-runtime").JSX.Element>;
|
20
|
+
export {};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import { RefObject } from "react";
|
2
2
|
import { RapierContext, WorldStepCallback } from "../components/Physics.js";
|
3
3
|
import { Object3D } from "three";
|
4
4
|
import { ColliderProps, RigidBodyProps } from "../index.js";
|
@@ -20,4 +20,4 @@ export declare const useAfterPhysicsStep: (callback: WorldStepCallback) => void;
|
|
20
20
|
/**
|
21
21
|
* @internal
|
22
22
|
*/
|
23
|
-
export declare const useChildColliderProps: <O extends Object3D
|
23
|
+
export declare const useChildColliderProps: <O extends Object3D>(ref: RefObject<O | undefined | null>, options: RigidBodyProps, ignoreMeshColliders?: boolean) => ColliderProps[];
|
@@ -5,7 +5,7 @@ import type Rapier from "@dimforge/rapier3d-compat";
|
|
5
5
|
/**
|
6
6
|
* @internal
|
7
7
|
*/
|
8
|
-
export declare const useImpulseJoint: <JointType extends ImpulseJoint>(body1: RefObject<RapierRigidBody>, body2: RefObject<RapierRigidBody>, params: Rapier.JointData) =>
|
8
|
+
export declare const useImpulseJoint: <JointType extends ImpulseJoint>(body1: RefObject<RapierRigidBody>, body2: RefObject<RapierRigidBody>, params: Rapier.JointData) => RefObject<JointType | undefined>;
|
9
9
|
/**
|
10
10
|
* A fixed joint ensures that two rigid-bodies don't move relative to each other.
|
11
11
|
* Fixed joints are characterized by one local frame (represented by an isometry) on each rigid-body.
|
@@ -1,23 +1,23 @@
|
|
1
|
-
import {
|
1
|
+
import { RefObject } from "react";
|
2
2
|
import { ActiveCollisionTypes, CoefficientCombineRule, ImpulseJoint, InteractionGroups, Collider as RapierCollider, RigidBody as RapierRigidBody, TempContactManifold } from "@dimforge/rapier3d-compat";
|
3
3
|
import { Rotation, Vector } from "@dimforge/rapier3d-compat/math";
|
4
|
-
import {
|
4
|
+
import { Quaternion, ThreeElements, Vector3 } from "@react-three/fiber";
|
5
5
|
import { Object3D } from "three";
|
6
6
|
import { ColliderProps } from "./index.js";
|
7
7
|
import { RigidBodyState } from "./components/Physics.js";
|
8
8
|
export { CoefficientCombineRule as CoefficientCombineRule } from "@dimforge/rapier3d-compat";
|
9
9
|
export { RapierCollider, RapierRigidBody };
|
10
|
-
export
|
11
|
-
export
|
12
|
-
export
|
10
|
+
export type RefGetter<T> = RefObject<() => T | undefined>;
|
11
|
+
export type RigidBodyAutoCollider = "ball" | "cuboid" | "hull" | "trimesh" | false;
|
12
|
+
export type CuboidArgs = [
|
13
13
|
halfWidth: number,
|
14
14
|
halfHeight: number,
|
15
15
|
halfDepth: number
|
16
16
|
];
|
17
|
-
export
|
18
|
-
export
|
19
|
-
export
|
20
|
-
export
|
17
|
+
export type BallArgs = [radius: number];
|
18
|
+
export type CapsuleArgs = [halfHeight: number, radius: number];
|
19
|
+
export type ConvexHullArgs = [vertices: ArrayLike<number>];
|
20
|
+
export type HeightfieldArgs = [
|
21
21
|
width: number,
|
22
22
|
height: number,
|
23
23
|
heights: number[],
|
@@ -27,66 +27,54 @@ export declare type HeightfieldArgs = [
|
|
27
27
|
z: number;
|
28
28
|
}
|
29
29
|
];
|
30
|
-
export
|
30
|
+
export type TrimeshArgs = [
|
31
31
|
vertices: ArrayLike<number>,
|
32
32
|
indices: ArrayLike<number>
|
33
33
|
];
|
34
|
-
export
|
35
|
-
export
|
34
|
+
export type PolylineArgs = [vertices: Float32Array, indices: Uint32Array];
|
35
|
+
export type RoundCuboidArgs = [
|
36
36
|
halfWidth: number,
|
37
37
|
halfHeight: number,
|
38
38
|
halfDepth: number,
|
39
39
|
borderRadius: number
|
40
40
|
];
|
41
|
-
export
|
42
|
-
export
|
41
|
+
export type CylinderArgs = [halfHeight: number, radius: number];
|
42
|
+
export type RoundCylinderArgs = [
|
43
43
|
halfHeight: number,
|
44
44
|
radius: number,
|
45
45
|
borderRadius: number
|
46
46
|
];
|
47
|
-
export
|
48
|
-
export
|
47
|
+
export type ConeArgs = [halfHeight: number, radius: number];
|
48
|
+
export type RoundConeArgs = [
|
49
49
|
halfHeight: number,
|
50
50
|
radius: number,
|
51
51
|
borderRadius: number
|
52
52
|
];
|
53
|
-
export
|
53
|
+
export type ConvexMeshArgs = [
|
54
54
|
vertices: ArrayLike<number>,
|
55
55
|
indices: ArrayLike<number>
|
56
56
|
];
|
57
|
-
export
|
57
|
+
export type RoundConvexHullArgs = [
|
58
58
|
vertices: ArrayLike<number>,
|
59
59
|
indices: ArrayLike<number>,
|
60
60
|
borderRadius: number
|
61
61
|
];
|
62
|
-
export
|
62
|
+
export type RoundConvexMeshArgs = [
|
63
63
|
vertices: ArrayLike<number>,
|
64
64
|
indices: ArrayLike<number>,
|
65
65
|
borderRadius: number
|
66
66
|
];
|
67
|
-
export
|
68
|
-
export
|
69
|
-
export
|
70
|
-
export
|
71
|
-
export
|
72
|
-
export
|
73
|
-
export
|
67
|
+
export type UseBodyOptions = Omit<RigidBodyOptions, "shape">;
|
68
|
+
export type RigidBodyTypeString = "fixed" | "dynamic" | "kinematicPosition" | "kinematicVelocity";
|
69
|
+
export type ColliderShape = "cuboid" | "trimesh" | "ball" | "capsule" | "convexHull" | "heightfield" | "polyline" | "roundCuboid" | "cylinder" | "roundCylinder" | "cone" | "roundCone" | "convexMesh" | "roundConvexHull" | "roundConvexMesh";
|
70
|
+
export type Vector3Tuple = [x: number, y: number, z: number];
|
71
|
+
export type Vector4Tuple = [x: number, y: number, z: number, w: number];
|
72
|
+
export type Boolean3Tuple = [x: boolean, y: boolean, z: boolean];
|
73
|
+
export type Vector3Object = {
|
74
74
|
x: number;
|
75
75
|
y: number;
|
76
76
|
z: number;
|
77
77
|
};
|
78
|
-
/**
|
79
|
-
* @deprecated use Vector3Tuple instead
|
80
|
-
*/
|
81
|
-
export declare type Vector3Array = Vector3Tuple;
|
82
|
-
/**
|
83
|
-
* @deprecated use Vector4Tuple instead
|
84
|
-
* */
|
85
|
-
export declare type Vector4Array = Vector4Tuple;
|
86
|
-
/**
|
87
|
-
* @deprecated use Boolean3Tuple instead
|
88
|
-
* */
|
89
|
-
export declare type Boolean3Array = Boolean3Tuple;
|
90
78
|
export interface ColliderOptions<ColliderArgs extends Array<unknown>> {
|
91
79
|
/**
|
92
80
|
* The optional name passed to THREE's Object3D
|
@@ -125,19 +113,19 @@ export interface ColliderOptions<ColliderArgs extends Array<unknown>> {
|
|
125
113
|
/**
|
126
114
|
* The position of this collider relative to the rigid body
|
127
115
|
*/
|
128
|
-
position?:
|
116
|
+
position?: ThreeElements["object3D"]["position"];
|
129
117
|
/**
|
130
118
|
* The rotation of this collider relative to the rigid body
|
131
119
|
*/
|
132
|
-
rotation?:
|
120
|
+
rotation?: ThreeElements["object3D"]["rotation"];
|
133
121
|
/**
|
134
122
|
* The rotation, as a Quaternion, of this collider relative to the rigid body
|
135
123
|
*/
|
136
|
-
quaternion?:
|
124
|
+
quaternion?: ThreeElements["object3D"]["quaternion"];
|
137
125
|
/**
|
138
126
|
* The scale of this collider relative to the rigid body
|
139
127
|
*/
|
140
|
-
scale?:
|
128
|
+
scale?: ThreeElements["object3D"]["scale"];
|
141
129
|
/**
|
142
130
|
* Callback when this collider collideas with another collider.
|
143
131
|
*/
|
@@ -218,13 +206,13 @@ export interface ColliderOptions<ColliderArgs extends Array<unknown>> {
|
|
218
206
|
*/
|
219
207
|
sensor?: boolean;
|
220
208
|
}
|
221
|
-
export
|
209
|
+
export type CollisionTarget = {
|
222
210
|
rigidBody?: RapierRigidBody;
|
223
211
|
collider: RapierCollider;
|
224
212
|
rigidBodyObject?: Object3D;
|
225
213
|
colliderObject?: Object3D;
|
226
214
|
};
|
227
|
-
export
|
215
|
+
export type CollisionPayload = {
|
228
216
|
/** the object firing the event */
|
229
217
|
target: CollisionTarget;
|
230
218
|
/** the other object involved in the event */
|
@@ -238,25 +226,25 @@ export declare type CollisionPayload = {
|
|
238
226
|
/** deprecated use `payload.other.colliderObject` instead */
|
239
227
|
colliderObject?: Object3D;
|
240
228
|
};
|
241
|
-
export
|
229
|
+
export type CollisionEnterPayload = CollisionPayload & {
|
242
230
|
manifold: TempContactManifold;
|
243
231
|
flipped: boolean;
|
244
232
|
};
|
245
|
-
export
|
246
|
-
export
|
247
|
-
export
|
248
|
-
export
|
233
|
+
export type CollisionExitPayload = CollisionPayload;
|
234
|
+
export type IntersectionEnterPayload = CollisionPayload;
|
235
|
+
export type IntersectionExitPayload = CollisionPayload;
|
236
|
+
export type ContactForcePayload = CollisionPayload & {
|
249
237
|
totalForce: Vector;
|
250
238
|
totalForceMagnitude: number;
|
251
239
|
maxForceDirection: Vector;
|
252
240
|
maxForceMagnitude: number;
|
253
241
|
};
|
254
|
-
export
|
255
|
-
export
|
256
|
-
export
|
257
|
-
export
|
258
|
-
export
|
259
|
-
export interface RigidBodyOptions extends ColliderProps {
|
242
|
+
export type CollisionEnterHandler = (payload: CollisionEnterPayload) => void;
|
243
|
+
export type CollisionExitHandler = (payload: CollisionExitPayload) => void;
|
244
|
+
export type IntersectionEnterHandler = (payload: IntersectionEnterPayload) => void;
|
245
|
+
export type IntersectionExitHandler = (payload: IntersectionExitPayload) => void;
|
246
|
+
export type ContactForceHandler = (payload: ContactForcePayload) => void;
|
247
|
+
export interface RigidBodyOptions extends Omit<ColliderProps, "ref"> {
|
260
248
|
/**
|
261
249
|
* Specify the type of this rigid body
|
262
250
|
*/
|
@@ -315,11 +303,11 @@ export interface RigidBodyOptions extends ColliderProps {
|
|
315
303
|
/**
|
316
304
|
* Initial position of the RigidBody
|
317
305
|
*/
|
318
|
-
position?:
|
306
|
+
position?: ThreeElements["object3D"]["position"];
|
319
307
|
/**
|
320
308
|
* Initial rotation of the RigidBody
|
321
309
|
*/
|
322
|
-
rotation?:
|
310
|
+
rotation?: ThreeElements["object3D"]["rotation"];
|
323
311
|
/**
|
324
312
|
* Automatically generate colliders based on meshes inside this
|
325
313
|
* rigid body.
|
@@ -391,7 +379,7 @@ export interface RigidBodyOptions extends ColliderProps {
|
|
391
379
|
/**
|
392
380
|
* Passed down to the object3d representing this collider.
|
393
381
|
*/
|
394
|
-
userData?:
|
382
|
+
userData?: ThreeElements["object3D"]["userData"];
|
395
383
|
/**
|
396
384
|
* Include invisible objects on the collider creation estimation.
|
397
385
|
*/
|
@@ -402,31 +390,31 @@ export interface RigidBodyOptions extends ColliderProps {
|
|
402
390
|
*/
|
403
391
|
transformState?: (state: RigidBodyState) => RigidBodyState;
|
404
392
|
}
|
405
|
-
export
|
406
|
-
export
|
393
|
+
export type SphericalJointParams = [body1Anchor: Vector3, body2Anchor: Vector3];
|
394
|
+
export type FixedJointParams = [
|
407
395
|
body1Anchor: Vector3,
|
408
396
|
body1LocalFrame: Quaternion,
|
409
397
|
body2Anchor: Vector3,
|
410
398
|
body2LocalFrame: Quaternion
|
411
399
|
];
|
412
|
-
export
|
400
|
+
export type PrismaticJointParams = [
|
413
401
|
body1Anchor: Vector3,
|
414
402
|
body2Anchor: Vector3,
|
415
403
|
axis: Vector3,
|
416
404
|
limits?: [min: number, max: number]
|
417
405
|
];
|
418
|
-
export
|
406
|
+
export type RevoluteJointParams = [
|
419
407
|
body1Anchor: Vector3,
|
420
408
|
body2Anchor: Vector3,
|
421
409
|
axis: Vector3,
|
422
410
|
limits?: [min: number, max: number]
|
423
411
|
];
|
424
|
-
export
|
412
|
+
export type RopeJointParams = [
|
425
413
|
body1Anchor: Vector3,
|
426
414
|
body2Anchor: Vector3,
|
427
415
|
length: number
|
428
416
|
];
|
429
|
-
export
|
417
|
+
export type SpringJointParams = [
|
430
418
|
body1Anchor: Vector3,
|
431
419
|
body2Anchor: Vector3,
|
432
420
|
restLength: number,
|
@@ -31,4 +31,4 @@ import { InteractionGroups } from "@dimforge/rapier3d-compat";
|
|
31
31
|
* @param filters Groups the interaction group should filter against. (Values can range from 0 to 15.)
|
32
32
|
* @returns An InteractionGroup bitmask.
|
33
33
|
*/
|
34
|
-
export declare const interactionGroups: (memberships: number | number[], filters?: number | number[]
|
34
|
+
export declare const interactionGroups: (memberships: number | number[], filters?: number | number[]) => InteractionGroups;
|