@absolutejs/rapier3d 0.0.0-stage → 0.2.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.
Files changed (49) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +85 -2
  3. package/dist/provenance.json +10 -0
  4. package/dist/rapier.mjs +1 -0
  5. package/dist/types/coarena.d.ts +15 -0
  6. package/dist/types/control/character_controller.d.ts +191 -0
  7. package/dist/types/control/index.d.ts +3 -0
  8. package/dist/types/control/pid_controller.d.ts +50 -0
  9. package/dist/types/control/ray_cast_vehicle_controller.d.ts +277 -0
  10. package/dist/types/dynamics/ccd_solver.d.ts +15 -0
  11. package/dist/types/dynamics/coefficient_combine_rule.d.ts +13 -0
  12. package/dist/types/dynamics/impulse_joint.d.ts +359 -0
  13. package/dist/types/dynamics/impulse_joint_set.d.ts +84 -0
  14. package/dist/types/dynamics/index.d.ts +12 -0
  15. package/dist/types/dynamics/integration_parameters.d.ts +109 -0
  16. package/dist/types/dynamics/island_manager.d.ts +24 -0
  17. package/dist/types/dynamics/multibody_joint.d.ts +42 -0
  18. package/dist/types/dynamics/multibody_joint_set.d.ts +81 -0
  19. package/dist/types/dynamics/rigid_body.d.ts +839 -0
  20. package/dist/types/dynamics/rigid_body_set.d.ts +90 -0
  21. package/dist/types/dynamics/soft_body.d.ts +1210 -0
  22. package/dist/types/dynamics/soft_body_set.d.ts +99 -0
  23. package/dist/types/exports.d.ts +8 -0
  24. package/dist/types/geometry/broad_phase.d.ts +162 -0
  25. package/dist/types/geometry/collider.d.ts +1016 -0
  26. package/dist/types/geometry/collider_set.d.ts +97 -0
  27. package/dist/types/geometry/contact.d.ts +36 -0
  28. package/dist/types/geometry/feature.d.ts +6 -0
  29. package/dist/types/geometry/index.d.ts +11 -0
  30. package/dist/types/geometry/interaction_groups.d.ts +18 -0
  31. package/dist/types/geometry/narrow_phase.d.ts +151 -0
  32. package/dist/types/geometry/point.d.ts +58 -0
  33. package/dist/types/geometry/ray.d.ts +108 -0
  34. package/dist/types/geometry/shape.d.ts +681 -0
  35. package/dist/types/geometry/toi.d.ts +59 -0
  36. package/dist/types/init.d.ts +3 -0
  37. package/dist/types/math.d.ts +98 -0
  38. package/dist/types/pipeline/debug_render_pipeline.d.ts +40 -0
  39. package/dist/types/pipeline/event_queue.d.ts +113 -0
  40. package/dist/types/pipeline/index.d.ts +7 -0
  41. package/dist/types/pipeline/physics_hooks.d.ts +39 -0
  42. package/dist/types/pipeline/physics_pipeline.d.ts +12 -0
  43. package/dist/types/pipeline/query_pipeline.d.ts +38 -0
  44. package/dist/types/pipeline/serialization_pipeline.d.ts +37 -0
  45. package/dist/types/pipeline/world.d.ts +674 -0
  46. package/dist/types/rapier.d.ts +3 -0
  47. package/dist/types/rapier_wasm3d.d.ts +2929 -0
  48. package/dist/types/raw.d.ts +1 -0
  49. package/package.json +33 -4
@@ -0,0 +1,359 @@
1
+ import { Rotation, Vector } from "../math";
2
+ import { RawGenericJoint, RawImpulseJointSet, RawJointAxis } from "../raw";
3
+ import { RigidBody } from "./rigid_body";
4
+ import { RigidBodySet } from "./rigid_body_set";
5
+ /**
6
+ * The integer identifier of a collider added to a `ColliderSet`.
7
+ */
8
+ export type ImpulseJointHandle = number;
9
+ /**
10
+ * An enum grouping all possible types of joints:
11
+ *
12
+ * - `Revolute`: A revolute joint that removes all degrees of freedom between the affected
13
+ * bodies except for the rotation along one axis.
14
+ * - `Fixed`: A fixed joint that removes all relative degrees of freedom between the affected bodies.
15
+ * - `Prismatic`: A prismatic joint that removes all degrees of freedom between the affected
16
+ * bodies except for the translation along one axis.
17
+ * - `Spherical`: (3D only) A spherical joint that removes all relative linear degrees of freedom between the affected bodies.
18
+ * - `Generic`: (3D only) A joint with customizable degrees of freedom, allowing any of the 6 axes to be locked.
19
+ */
20
+ export declare enum JointType {
21
+ Revolute = 0,
22
+ Fixed = 1,
23
+ Prismatic = 2,
24
+ Rope = 3,
25
+ Spring = 4,
26
+ Spherical = 5,
27
+ Generic = 6
28
+ }
29
+ export declare enum MotorModel {
30
+ AccelerationBased = 0,
31
+ ForceBased = 1
32
+ }
33
+ /**
34
+ * An enum representing a single joint axis, used to configure per-axis joint
35
+ * properties like the motors of a spherical joint.
36
+ */
37
+ export declare enum JointAxis {
38
+ LinX = 0,
39
+ LinY = 1,
40
+ LinZ = 2,
41
+ AngX = 3,
42
+ AngY = 4,
43
+ AngZ = 5
44
+ }
45
+ /**
46
+ * An enum representing the possible joint axes of a generic joint.
47
+ * They can be ORed together, like:
48
+ * JointAxesMask.LinX || JointAxesMask.LinY
49
+ * to get a joint that is only free in the X and Y translational (positional) axes.
50
+ *
51
+ * Possible free axes are:
52
+ *
53
+ * - `X`: X translation axis
54
+ * - `Y`: Y translation axis
55
+ * - `Z`: Z translation axis
56
+ * - `AngX`: X angular rotation axis
57
+ * - `AngY`: Y angular rotations axis
58
+ * - `AngZ`: Z angular rotation axis
59
+ */
60
+ export declare enum JointAxesMask {
61
+ LinX = 1,
62
+ LinY = 2,
63
+ LinZ = 4,
64
+ AngX = 8,
65
+ AngY = 16,
66
+ AngZ = 32
67
+ }
68
+ export declare class ImpulseJoint {
69
+ protected rawSet: RawImpulseJointSet;
70
+ protected bodySet: RigidBodySet;
71
+ handle: ImpulseJointHandle;
72
+ constructor(rawSet: RawImpulseJointSet, bodySet: RigidBodySet, handle: ImpulseJointHandle);
73
+ static newTyped(rawSet: RawImpulseJointSet, bodySet: RigidBodySet, handle: ImpulseJointHandle): ImpulseJoint;
74
+ /** @internal */
75
+ finalizeDeserialization(bodySet: RigidBodySet): void;
76
+ /**
77
+ * Checks if this joint is still valid (i.e. that it has
78
+ * not been deleted from the joint set yet).
79
+ */
80
+ isValid(): boolean;
81
+ /**
82
+ * The first rigid-body this joint it attached to.
83
+ */
84
+ body1(): RigidBody;
85
+ /**
86
+ * The second rigid-body this joint is attached to.
87
+ */
88
+ body2(): RigidBody;
89
+ /**
90
+ * The type of this joint given as a string.
91
+ */
92
+ type(): JointType;
93
+ /**
94
+ * The rotation quaternion that aligns this joint's first local axis to the `x` axis.
95
+ *
96
+ * @param {Rotation?} target - The object to be populated. If provided,
97
+ * the function returns this object instead of creating a new one.
98
+ */
99
+ frameX1(target?: Rotation): Rotation;
100
+ /**
101
+ * The rotation matrix that aligns this joint's second local axis to the `x` axis.
102
+ *
103
+ * @param {Rotation?} target - The object to be populated. If provided,
104
+ * the function returns this object instead of creating a new one.
105
+ */
106
+ frameX2(target?: Rotation): Rotation;
107
+ /**
108
+ * The position of the first anchor of this joint.
109
+ *
110
+ * The first anchor gives the position of the application point on the
111
+ * local frame of the first rigid-body it is attached to.
112
+ *
113
+ * @param {Vector?} target - The object to be populated. If provided,
114
+ * the function returns this object instead of creating a new one.
115
+ */
116
+ anchor1(target?: Vector): Vector;
117
+ /**
118
+ * The position of the second anchor of this joint.
119
+ *
120
+ * The second anchor gives the position of the application point on the
121
+ * local frame of the second rigid-body it is attached to.
122
+ *
123
+ * @param {Vector?} target - The object to be populated. If provided,
124
+ * the function returns this object instead of creating a new one.
125
+ */
126
+ anchor2(target?: Vector): Vector;
127
+ /**
128
+ * Sets the position of the first anchor of this joint.
129
+ *
130
+ * The first anchor gives the position of the application point on the
131
+ * local frame of the first rigid-body it is attached to.
132
+ */
133
+ setAnchor1(newPos: Vector): void;
134
+ /**
135
+ * Sets the position of the second anchor of this joint.
136
+ *
137
+ * The second anchor gives the position of the application point on the
138
+ * local frame of the second rigid-body it is attached to.
139
+ */
140
+ setAnchor2(newPos: Vector): void;
141
+ /**
142
+ * Sets the rotation quaternion that aligns this joint's first local axis to the `x` axis.
143
+ */
144
+ setFrameX1(rot: Rotation): void;
145
+ /**
146
+ * Sets the rotation quaternion that aligns this joint's second local axis to the `x` axis.
147
+ */
148
+ setFrameX2(rot: Rotation): void;
149
+ /**
150
+ * Sets the full local frame (anchor position and rotation) for the first rigid-body attachment.
151
+ */
152
+ setLocalFrame1(anchor: Vector, rot: Rotation): void;
153
+ /**
154
+ * Sets the full local frame (anchor position and rotation) for the second rigid-body attachment.
155
+ */
156
+ setLocalFrame2(anchor: Vector, rot: Rotation): void;
157
+ /**
158
+ * Controls whether contacts are computed between colliders attached
159
+ * to the rigid-bodies linked by this joint.
160
+ */
161
+ setContactsEnabled(enabled: boolean): void;
162
+ /**
163
+ * Indicates if contacts are enabled between colliders attached
164
+ * to the rigid-bodies linked by this joint.
165
+ */
166
+ contactsEnabled(): boolean;
167
+ }
168
+ export declare class UnitImpulseJoint extends ImpulseJoint {
169
+ /**
170
+ * The axis left free by this joint.
171
+ */
172
+ protected rawAxis?(): RawJointAxis;
173
+ /**
174
+ * Are the limits enabled for this joint?
175
+ */
176
+ limitsEnabled(): boolean;
177
+ /**
178
+ * The min limit of this joint.
179
+ */
180
+ limitsMin(): number;
181
+ /**
182
+ * The max limit of this joint.
183
+ */
184
+ limitsMax(): number;
185
+ /**
186
+ * Sets the limits of this joint.
187
+ *
188
+ * @param min - The minimum bound of this joint’s free coordinate.
189
+ * @param max - The maximum bound of this joint’s free coordinate.
190
+ */
191
+ setLimits(min: number, max: number): void;
192
+ configureMotorModel(model: MotorModel): void;
193
+ setMotorMaxForce(maxForce: number): void;
194
+ configureMotorVelocity(targetVel: number, factor: number): void;
195
+ configureMotorPosition(targetPos: number, stiffness: number, damping: number): void;
196
+ configureMotor(targetPos: number, targetVel: number, stiffness: number, damping: number): void;
197
+ }
198
+ export declare class FixedImpulseJoint extends ImpulseJoint {
199
+ }
200
+ export declare class RopeImpulseJoint extends ImpulseJoint {
201
+ }
202
+ export declare class SpringImpulseJoint extends ImpulseJoint {
203
+ }
204
+ export declare class PrismaticImpulseJoint extends UnitImpulseJoint {
205
+ rawAxis(): RawJointAxis;
206
+ }
207
+ export declare class RevoluteImpulseJoint extends UnitImpulseJoint {
208
+ rawAxis(): RawJointAxis;
209
+ }
210
+ export declare class GenericImpulseJoint extends ImpulseJoint {
211
+ }
212
+ export declare class SphericalImpulseJoint extends ImpulseJoint {
213
+ /**
214
+ * Sets the motor model of one of this joint's angular axes.
215
+ *
216
+ * @param axis - The angular axis (`JointAxis.AngX/AngY/AngZ`) to configure.
217
+ * @param model - The motor model to apply to that axis.
218
+ */
219
+ configureMotorModel(axis: JointAxis, model: MotorModel): void;
220
+ /**
221
+ * Sets the maximum force/torque the motor of the given angular axis can deliver.
222
+ *
223
+ * @param axis - The angular axis (`JointAxis.AngX/AngY/AngZ`) to configure.
224
+ * @param maxForce - The maximum torque the axis motor can deliver.
225
+ */
226
+ setMotorMaxForce(axis: JointAxis, maxForce: number): void;
227
+ /**
228
+ * Makes the motor of the given angular axis target a specific angular velocity.
229
+ *
230
+ * @param axis - The angular axis (`JointAxis.AngX/AngY/AngZ`) to configure.
231
+ * @param targetVel - The target angular velocity along the axis, in radians per second.
232
+ * @param factor - The strength used to reach the target velocity (a damping coefficient).
233
+ */
234
+ configureMotorVelocity(axis: JointAxis, targetVel: number, factor: number): void;
235
+ /**
236
+ * Makes the motor of the given angular axis target a specific angle.
237
+ *
238
+ * @param axis - The angular axis (`JointAxis.AngX/AngY/AngZ`) to configure.
239
+ * @param targetPos - The target angle along the axis, in radians.
240
+ * @param stiffness - The spring-like stiffness used to reach the target angle.
241
+ * @param damping - The damping applied to the axis' angular velocity.
242
+ */
243
+ configureMotorPosition(axis: JointAxis, targetPos: number, stiffness: number, damping: number): void;
244
+ /**
245
+ * Configures the motor of the given angular axis with both an angle and an
246
+ * angular-velocity target.
247
+ *
248
+ * @param axis - The angular axis (`JointAxis.AngX/AngY/AngZ`) to configure.
249
+ * @param targetPos - The target angle along the axis, in radians.
250
+ * @param targetVel - The target angular velocity along the axis, in radians per second.
251
+ * @param stiffness - The spring-like stiffness used to reach the target angle.
252
+ * @param damping - The damping applied to the axis' angular velocity.
253
+ */
254
+ configureMotor(axis: JointAxis, targetPos: number, targetVel: number, stiffness: number, damping: number): void;
255
+ }
256
+ export declare class JointData {
257
+ anchor1: Vector;
258
+ anchor2: Vector;
259
+ axis: Vector;
260
+ axis1: Vector;
261
+ axis2: Vector;
262
+ frame1: Rotation;
263
+ frame2: Rotation;
264
+ jointType: JointType;
265
+ limitsEnabled: boolean;
266
+ limits: Array<number>;
267
+ axesMask: JointAxesMask;
268
+ stiffness: number;
269
+ damping: number;
270
+ length: number;
271
+ private constructor();
272
+ /**
273
+ * Creates a new joint descriptor that builds a Fixed joint.
274
+ *
275
+ * A fixed joint removes all the degrees of freedom between the affected bodies, ensuring their
276
+ * anchor and local frames coincide in world-space.
277
+ *
278
+ * @param anchor1 - Point where the joint is attached on the first rigid-body affected by this joint. Expressed in the
279
+ * local-space of the rigid-body.
280
+ * @param frame1 - The reference orientation of the joint wrt. the first rigid-body.
281
+ * @param anchor2 - Point where the joint is attached on the second rigid-body affected by this joint. Expressed in the
282
+ * local-space of the rigid-body.
283
+ * @param frame2 - The reference orientation of the joint wrt. the second rigid-body.
284
+ */
285
+ static fixed(anchor1: Vector, frame1: Rotation, anchor2: Vector, frame2: Rotation): JointData;
286
+ static spring(rest_length: number, stiffness: number, damping: number, anchor1: Vector, anchor2: Vector): JointData;
287
+ static rope(length: number, anchor1: Vector, anchor2: Vector): JointData;
288
+ /**
289
+ * Create a new joint descriptor that builds generic joints.
290
+ *
291
+ * A generic joint allows customizing its degrees of freedom
292
+ * by supplying a mask of the joint axes that should remain locked.
293
+ *
294
+ * @param anchor1 - Point where the joint is attached on the first rigid-body affected by this joint. Expressed in the
295
+ * local-space of the rigid-body.
296
+ * @param anchor2 - Point where the joint is attached on the second rigid-body affected by this joint. Expressed in the
297
+ * local-space of the rigid-body.
298
+ * @param axis - The X axis of the joint, expressed in the local-space of the rigid-bodies it is attached to.
299
+ * @param axesMask - Mask representing the locked axes of the joint. You can use logical OR to select these from
300
+ * the JointAxesMask enum. For example, passing (JointAxesMask.AngX || JointAxesMask.AngY) will
301
+ * create a joint locked in the X and Y rotational axes.
302
+ */
303
+ static generic(anchor1: Vector, anchor2: Vector, axis: Vector, axesMask: JointAxesMask): JointData;
304
+ /**
305
+ * Create a new joint descriptor that builds spherical joints.
306
+ *
307
+ * A spherical joint allows three relative rotational degrees of freedom
308
+ * by preventing any relative translation between the anchors of the
309
+ * two attached rigid-bodies.
310
+ *
311
+ * @param anchor1 - Point where the joint is attached on the first rigid-body affected by this joint. Expressed in the
312
+ * local-space of the rigid-body.
313
+ * @param anchor2 - Point where the joint is attached on the second rigid-body affected by this joint. Expressed in the
314
+ * local-space of the rigid-body.
315
+ */
316
+ static spherical(anchor1: Vector, anchor2: Vector): JointData;
317
+ /**
318
+ * Creates a new joint descriptor that builds a Prismatic joint.
319
+ *
320
+ * A prismatic joint removes all the degrees of freedom between the
321
+ * affected bodies, except for the translation along one axis.
322
+ *
323
+ * @param anchor1 - Point where the joint is attached on the first rigid-body affected by this joint. Expressed in the
324
+ * local-space of the rigid-body.
325
+ * @param anchor2 - Point where the joint is attached on the second rigid-body affected by this joint. Expressed in the
326
+ * local-space of the rigid-body.
327
+ * @param axis - Axis of the joint, expressed in the local-space of the rigid-bodies it is attached to.
328
+ */
329
+ static prismatic(anchor1: Vector, anchor2: Vector, axis: Vector): JointData;
330
+ /**
331
+ * Create a new joint descriptor that builds Revolute joints.
332
+ *
333
+ * A revolute joint removes all degrees of freedom between the affected
334
+ * bodies except for the rotation along one axis.
335
+ *
336
+ * @param anchor1 - Point where the joint is attached on the first rigid-body affected by this joint. Expressed in the
337
+ * local-space of the rigid-body.
338
+ * @param anchor2 - Point where the joint is attached on the second rigid-body affected by this joint. Expressed in the
339
+ * local-space of the rigid-body.
340
+ * @param axis - Axis of the joint, expressed in the local-space of the rigid-bodies it is attached to.
341
+ */
342
+ static revolute(anchor1: Vector, anchor2: Vector, axis: Vector): JointData;
343
+ /**
344
+ * Create a new joint descriptor that builds Revolute joints with independent
345
+ * local axes for each attached rigid-body.
346
+ *
347
+ * This is useful when the same world-space hinge axis is represented by
348
+ * different local axes on the two bodies.
349
+ *
350
+ * @param anchor1 - Point where the joint is attached on the first rigid-body affected by this joint. Expressed in the
351
+ * local-space of the rigid-body.
352
+ * @param anchor2 - Point where the joint is attached on the second rigid-body affected by this joint. Expressed in the
353
+ * local-space of the rigid-body.
354
+ * @param axis1 - Axis of the joint, expressed in the local-space of the first rigid-body.
355
+ * @param axis2 - Axis of the joint, expressed in the local-space of the second rigid-body.
356
+ */
357
+ static revoluteWithAxes(anchor1: Vector, anchor2: Vector, axis1: Vector, axis2: Vector): JointData;
358
+ intoRaw(): RawGenericJoint;
359
+ }
@@ -0,0 +1,84 @@
1
+ import { RawImpulseJointSet } from "../raw";
2
+ import { RigidBodySet } from "./rigid_body_set";
3
+ import { ImpulseJoint, ImpulseJointHandle, JointData } from "./impulse_joint";
4
+ import { RigidBodyHandle } from "./rigid_body";
5
+ /**
6
+ * A set of joints.
7
+ *
8
+ * To avoid leaking WASM resources, this MUST be freed manually with `jointSet.free()`
9
+ * once you are done using it (and all the joints it created).
10
+ */
11
+ export declare class ImpulseJointSet {
12
+ raw: RawImpulseJointSet;
13
+ private map;
14
+ /**
15
+ * Release the WASM memory occupied by this joint set.
16
+ */
17
+ free(): void;
18
+ constructor(raw?: RawImpulseJointSet);
19
+ /** @internal */
20
+ finalizeDeserialization(bodies: RigidBodySet): void;
21
+ /**
22
+ * Creates a new joint and return its integer handle.
23
+ *
24
+ * @param bodies - The set of rigid-bodies containing the bodies the joint is attached to.
25
+ * @param desc - The joint's parameters.
26
+ * @param parent1 - The handle of the first rigid-body this joint is attached to.
27
+ * @param parent2 - The handle of the second rigid-body this joint is attached to.
28
+ * @param wakeUp - Should the attached rigid-bodies be awakened?
29
+ */
30
+ createJoint(bodies: RigidBodySet, desc: JointData, parent1: RigidBodyHandle, parent2: RigidBodyHandle, wakeUp: boolean): ImpulseJoint;
31
+ /**
32
+ * Remove a joint from this set.
33
+ *
34
+ * @param handle - The integer handle of the joint.
35
+ * @param wakeUp - If `true`, the rigid-bodies attached by the removed joint will be woken-up automatically.
36
+ */
37
+ remove(handle: ImpulseJointHandle, wakeUp: boolean): void;
38
+ /**
39
+ * Calls the given closure with the integer handle of each impulse joint attached to this rigid-body.
40
+ *
41
+ * @param f - The closure called with the integer handle of each impulse joint attached to the rigid-body.
42
+ */
43
+ forEachJointHandleAttachedToRigidBody(handle: RigidBodyHandle, f: (handle: ImpulseJointHandle) => void): void;
44
+ /**
45
+ * Internal function, do not call directly.
46
+ * @param handle
47
+ */
48
+ unmap(handle: ImpulseJointHandle): void;
49
+ /**
50
+ * Drops the wrappers of the joints the engine removed on its own (the joints of removed
51
+ * soft bodies and clusters).
52
+ */
53
+ unmapRemovedJoints(): void;
54
+ /**
55
+ * The number of joints on this set.
56
+ */
57
+ len(): number;
58
+ /**
59
+ * Does this set contain a joint with the given handle?
60
+ *
61
+ * @param handle - The joint handle to check.
62
+ */
63
+ contains(handle: ImpulseJointHandle): boolean;
64
+ /**
65
+ * Gets the joint with the given handle.
66
+ *
67
+ * Returns `null` if no joint with the specified handle exists.
68
+ *
69
+ * @param handle - The integer handle of the joint to retrieve.
70
+ */
71
+ get(handle: ImpulseJointHandle): ImpulseJoint | null;
72
+ /**
73
+ * Applies the given closure to each joint contained by this set.
74
+ *
75
+ * @param f - The closure to apply.
76
+ */
77
+ forEach(f: (joint: ImpulseJoint) => void): void;
78
+ /**
79
+ * Gets all joints in the list.
80
+ *
81
+ * @returns joint list.
82
+ */
83
+ getAll(): ImpulseJoint[];
84
+ }
@@ -0,0 +1,12 @@
1
+ export * from "./rigid_body";
2
+ export * from "./rigid_body_set";
3
+ export * from "./integration_parameters";
4
+ export * from "./impulse_joint";
5
+ export * from "./impulse_joint_set";
6
+ export * from "./multibody_joint";
7
+ export * from "./multibody_joint_set";
8
+ export * from "./coefficient_combine_rule";
9
+ export * from "./ccd_solver";
10
+ export * from "./island_manager";
11
+ export * from "./soft_body";
12
+ export * from "./soft_body_set";
@@ -0,0 +1,109 @@
1
+ import { RawIntegrationParameters } from "../raw";
2
+ import { SoftRecoverySettings } from "./soft_body";
3
+ export declare class IntegrationParameters {
4
+ raw: RawIntegrationParameters;
5
+ constructor(raw?: RawIntegrationParameters);
6
+ /**
7
+ * Free the WASM memory used by these integration parameters.
8
+ */
9
+ free(): void;
10
+ /** Merge compatible contact manifolds into solver clusters. Upstream default: true. */
11
+ get contactClustering(): boolean;
12
+ /** Change between simulation steps; false may increase solver workload. */
13
+ set contactClustering(value: boolean);
14
+ /** Minimum CCD substep duration in seconds; upstream default is 1/60/100. */
15
+ get minCcdDt(): number;
16
+ /** Change between steps. Very small values may introduce numerical instability. */
17
+ set minCcdDt(value: number);
18
+ /**
19
+ * The timestep length (default: `1.0 / 60.0`)
20
+ */
21
+ get dt(): number;
22
+ /**
23
+ * The Error Reduction Parameter in `[0, 1]` is the proportion of
24
+ * the positional error to be corrected at each time step (default: `0.2`).
25
+ */
26
+ get contact_erp(): number;
27
+ get lengthUnit(): number;
28
+ /**
29
+ * Normalized amount of penetration the engine won’t attempt to correct (default: `0.001m`).
30
+ *
31
+ * This threshold considered by the physics engine is this value multiplied by the `lengthUnit`.
32
+ */
33
+ get normalizedAllowedLinearError(): number;
34
+ /**
35
+ * The maximal normalized distance separating two objects that will generate predictive contacts (default: `0.02`).
36
+ *
37
+ * This threshold considered by the physics engine is this value multiplied by the `lengthUnit`.
38
+ */
39
+ get normalizedPredictionDistance(): number;
40
+ /**
41
+ * The number of solver iterations run by the constraints solver for calculating forces (default: `4`).
42
+ */
43
+ get numSolverIterations(): number;
44
+ /**
45
+ * Number of internal Project Gauss Seidel (PGS) iterations run at each solver iteration (default: `1`).
46
+ */
47
+ get numInternalPgsIterations(): number;
48
+ /**
49
+ * Maximum number of substeps performed by the solver (default: `1`).
50
+ */
51
+ get maxCcdSubsteps(): number;
52
+ /**
53
+ * Strain beyond which a soft-body constraint is re-solved after the contacts inside every
54
+ * substep, so a light body buried under heavier ones is not torn (default: `0.75`).
55
+ */
56
+ get softBodiesResweepStrain(): number;
57
+ /**
58
+ * Maximum number of extra substeps a soft body requests for its island while it is hit
59
+ * fast (default: `4`; `0` disables the impact-adaptive substeps).
60
+ */
61
+ get softBodiesMaxExtraSubsteps(): number;
62
+ /**
63
+ * Factor applied to the contact softness natural frequencies for the soft-body contacts
64
+ * (default: `4.0`).
65
+ */
66
+ get softBodiesContactStiffening(): number;
67
+ /**
68
+ * The tangle detection and recovery settings shared by every soft body of the world.
69
+ *
70
+ * This gives back a copy: change it and assign it back to apply it.
71
+ */
72
+ get softBodiesRecovery(): SoftRecoverySettings;
73
+ /**
74
+ * Relative residual at which the conjugate gradient of the FEM soft-body solver stops
75
+ * (default: `1.0e-5`).
76
+ */
77
+ get softBodiesFemLinearTolerance(): number;
78
+ /**
79
+ * Hard cap on the conjugate-gradient iterations of the FEM soft-body solver, whatever the
80
+ * residual (default: `20`).
81
+ */
82
+ get softBodiesFemMaxLinearIterations(): number;
83
+ /**
84
+ * Largest number of degrees of freedom for which a FEM soft body is factorized directly
85
+ * (default: `600`); the larger ones rely on the conjugate gradient.
86
+ */
87
+ get softBodiesFemMaxDenseDofs(): number;
88
+ set dt(value: number);
89
+ set softBodiesResweepStrain(value: number);
90
+ set softBodiesMaxExtraSubsteps(value: number);
91
+ set softBodiesContactStiffening(value: number);
92
+ set softBodiesRecovery(value: SoftRecoverySettings);
93
+ set softBodiesFemLinearTolerance(value: number);
94
+ set softBodiesFemMaxLinearIterations(value: number);
95
+ set softBodiesFemMaxDenseDofs(value: number);
96
+ set contact_natural_frequency(value: number);
97
+ set lengthUnit(value: number);
98
+ set normalizedAllowedLinearError(value: number);
99
+ set normalizedPredictionDistance(value: number);
100
+ /**
101
+ * Sets the number of solver iterations run by the constraints solver for calculating forces (default: `4`).
102
+ */
103
+ set numSolverIterations(value: number);
104
+ /**
105
+ * Sets the number of internal Project Gauss Seidel (PGS) iterations run at each solver iteration (default: `1`).
106
+ */
107
+ set numInternalPgsIterations(value: number);
108
+ set maxCcdSubsteps(value: number);
109
+ }
@@ -0,0 +1,24 @@
1
+ import { RawIslandManager } from "../raw";
2
+ import { RigidBodyHandle } from "./rigid_body";
3
+ /**
4
+ * The CCD solver responsible for resolving Continuous Collision Detection.
5
+ *
6
+ * To avoid leaking WASM resources, this MUST be freed manually with `ccdSolver.free()`
7
+ * once you are done using it.
8
+ */
9
+ export declare class IslandManager {
10
+ raw: RawIslandManager;
11
+ /**
12
+ * Release the WASM memory occupied by this narrow-phase.
13
+ */
14
+ free(): void;
15
+ constructor(raw?: RawIslandManager);
16
+ /**
17
+ * Applies the given closure to the handle of each active rigid-bodies contained by this set.
18
+ *
19
+ * A rigid-body is active if it is not sleeping, i.e., if it moved recently.
20
+ *
21
+ * @param f - The closure to apply.
22
+ */
23
+ forEachActiveRigidBodyHandle(f: (handle: RigidBodyHandle) => void): void;
24
+ }
@@ -0,0 +1,42 @@
1
+ import { RawJointAxis, RawMultibodyJointSet } from "../raw";
2
+ /**
3
+ * The integer identifier of a collider added to a `ColliderSet`.
4
+ */
5
+ export type MultibodyJointHandle = number;
6
+ export declare class MultibodyJoint {
7
+ protected rawSet: RawMultibodyJointSet;
8
+ handle: MultibodyJointHandle;
9
+ constructor(rawSet: RawMultibodyJointSet, handle: MultibodyJointHandle);
10
+ static newTyped(rawSet: RawMultibodyJointSet, handle: MultibodyJointHandle): MultibodyJoint;
11
+ /**
12
+ * Checks if this joint is still valid (i.e. that it has
13
+ * not been deleted from the joint set yet).
14
+ */
15
+ isValid(): boolean;
16
+ /**
17
+ * Controls whether contacts are computed between colliders attached
18
+ * to the rigid-bodies linked by this joint.
19
+ */
20
+ setContactsEnabled(enabled: boolean): void;
21
+ /**
22
+ * Indicates if contacts are enabled between colliders attached
23
+ * to the rigid-bodies linked by this joint.
24
+ */
25
+ contactsEnabled(): boolean;
26
+ }
27
+ export declare class UnitMultibodyJoint extends MultibodyJoint {
28
+ /**
29
+ * The axis left free by this joint.
30
+ */
31
+ protected rawAxis?(): RawJointAxis;
32
+ }
33
+ export declare class FixedMultibodyJoint extends MultibodyJoint {
34
+ }
35
+ export declare class PrismaticMultibodyJoint extends UnitMultibodyJoint {
36
+ rawAxis(): RawJointAxis;
37
+ }
38
+ export declare class RevoluteMultibodyJoint extends UnitMultibodyJoint {
39
+ rawAxis(): RawJointAxis;
40
+ }
41
+ export declare class SphericalMultibodyJoint extends MultibodyJoint {
42
+ }