@absolutejs/rapier3d 0.0.0-stage → 0.1.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 (50) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +56 -2
  3. package/absolutejs/README.md +57 -0
  4. package/dist/provenance.json +10 -0
  5. package/dist/rapier.mjs +1 -0
  6. package/dist/types/coarena.d.ts +15 -0
  7. package/dist/types/control/character_controller.d.ts +191 -0
  8. package/dist/types/control/index.d.ts +3 -0
  9. package/dist/types/control/pid_controller.d.ts +50 -0
  10. package/dist/types/control/ray_cast_vehicle_controller.d.ts +277 -0
  11. package/dist/types/dynamics/ccd_solver.d.ts +15 -0
  12. package/dist/types/dynamics/coefficient_combine_rule.d.ts +13 -0
  13. package/dist/types/dynamics/impulse_joint.d.ts +359 -0
  14. package/dist/types/dynamics/impulse_joint_set.d.ts +84 -0
  15. package/dist/types/dynamics/index.d.ts +12 -0
  16. package/dist/types/dynamics/integration_parameters.d.ts +101 -0
  17. package/dist/types/dynamics/island_manager.d.ts +24 -0
  18. package/dist/types/dynamics/multibody_joint.d.ts +42 -0
  19. package/dist/types/dynamics/multibody_joint_set.d.ts +81 -0
  20. package/dist/types/dynamics/rigid_body.d.ts +839 -0
  21. package/dist/types/dynamics/rigid_body_set.d.ts +90 -0
  22. package/dist/types/dynamics/soft_body.d.ts +1210 -0
  23. package/dist/types/dynamics/soft_body_set.d.ts +99 -0
  24. package/dist/types/exports.d.ts +8 -0
  25. package/dist/types/geometry/broad_phase.d.ts +162 -0
  26. package/dist/types/geometry/collider.d.ts +1016 -0
  27. package/dist/types/geometry/collider_set.d.ts +97 -0
  28. package/dist/types/geometry/contact.d.ts +36 -0
  29. package/dist/types/geometry/feature.d.ts +6 -0
  30. package/dist/types/geometry/index.d.ts +11 -0
  31. package/dist/types/geometry/interaction_groups.d.ts +18 -0
  32. package/dist/types/geometry/narrow_phase.d.ts +140 -0
  33. package/dist/types/geometry/point.d.ts +58 -0
  34. package/dist/types/geometry/ray.d.ts +108 -0
  35. package/dist/types/geometry/shape.d.ts +681 -0
  36. package/dist/types/geometry/toi.d.ts +59 -0
  37. package/dist/types/init.d.ts +3 -0
  38. package/dist/types/math.d.ts +98 -0
  39. package/dist/types/pipeline/debug_render_pipeline.d.ts +40 -0
  40. package/dist/types/pipeline/event_queue.d.ts +113 -0
  41. package/dist/types/pipeline/index.d.ts +7 -0
  42. package/dist/types/pipeline/physics_hooks.d.ts +39 -0
  43. package/dist/types/pipeline/physics_pipeline.d.ts +12 -0
  44. package/dist/types/pipeline/query_pipeline.d.ts +38 -0
  45. package/dist/types/pipeline/serialization_pipeline.d.ts +37 -0
  46. package/dist/types/pipeline/world.d.ts +674 -0
  47. package/dist/types/rapier.d.ts +3 -0
  48. package/dist/types/rapier_wasm3d.d.ts +2908 -0
  49. package/dist/types/raw.d.ts +1 -0
  50. package/package.json +33 -4
@@ -0,0 +1,1210 @@
1
+ import { RawSoftBodyBuilder, RawSoftBodyMaterial, RawSoftBodySet, RawSoftBodyTearEvent, RawSoftMeshBindingMode, RawSoftRecoverySettings } from "../raw";
2
+ import { Rotation, Vector } from "../math";
3
+ import { RigidBody, RigidBodyHandle } from "./rigid_body";
4
+ import { RigidBodySet } from "./rigid_body_set";
5
+ import { Collider, ColliderDesc, ColliderSet } from "../geometry";
6
+ /**
7
+ * The integer identifier of a soft body added to a `SoftBodySet`.
8
+ */
9
+ export type SoftBodyHandle = number;
10
+ /**
11
+ * The constitutive model of a soft body's cells (triangles in 2D, tetrahedra in 3D).
12
+ */
13
+ export declare enum SoftBodyCellModel {
14
+ /**
15
+ * Per-cell area/volume preservation constraints (the cell's shape is held by its edges).
16
+ */
17
+ Volume = 0,
18
+ /**
19
+ * Corotational linear elasticity: a linear material in the cell's rotated frame.
20
+ */
21
+ Corotational = 1,
22
+ /**
23
+ * Neo-Hookean hyperelasticity, which resists inversion and large compressions.
24
+ */
25
+ NeoHookean = 2
26
+ }
27
+ /**
28
+ * Which strains make a soft body's edge rest lengths flow plastically.
29
+ */
30
+ export declare enum SoftEdgePlasticFlow {
31
+ Both = 0,
32
+ Compression = 1,
33
+ Tension = 2
34
+ }
35
+ /**
36
+ * Which solver holds the cells of a soft body together.
37
+ */
38
+ export declare enum SoftBodySolver {
39
+ /**
40
+ * Every element of the lattice becomes a constraint, solved with the contacts and the
41
+ * joints of the scene.
42
+ */
43
+ Constraints = 0,
44
+ /**
45
+ * The elasticity of the whole body is assembled into one linear system, solved at each
46
+ * substep; the stiffness of the body no longer depends on the iteration count. Needs cells.
47
+ */
48
+ Fem = 1
49
+ }
50
+ /**
51
+ * What the per-point constraints of the features an intersection-volume constraint acts on do.
52
+ */
53
+ export declare enum SoftPatchConstraints {
54
+ /**
55
+ * Keep them as they are (they may fight the volume constraint).
56
+ */
57
+ Keep = 0,
58
+ /**
59
+ * Stand them down: the volume constraint alone acts on those features.
60
+ */
61
+ StandDown = 1,
62
+ /**
63
+ * Keep them, but along the volume constraint's normal, so they push the way it does.
64
+ */
65
+ AlongNormal = 2
66
+ }
67
+ /**
68
+ * The tangle detection and recovery settings shared by every soft body of a world.
69
+ *
70
+ * A plain JavaScript object; read it from `IntegrationParameters.softBodiesRecovery` and
71
+ * assign it back to apply it. Every mechanism switches off individually.
72
+ */
73
+ export declare class SoftRecoverySettings {
74
+ /**
75
+ * Raise the speculative contact margin from velocities authored between steps, so a fast fresh body does not tunnel (default: `true`).
76
+ */
77
+ authoredVelocityMargin: boolean;
78
+ /**
79
+ * Give the edge-vs-edge pass a speculative reach, so bodies crossing corner-first collide; on, those constraints leave pressed 3D piles crossed (default: `false`).
80
+ */
81
+ edgeSpeculation: boolean;
82
+ /**
83
+ * Detect inverted cells (material locally inside out) at each step; feeds the self stand-down (default: `true`).
84
+ */
85
+ invertedCellDetection: boolean;
86
+ /**
87
+ * Detect surface self-crossings at each step; feeds the self stand-down (default: `true`).
88
+ */
89
+ selfCrossingDetection: boolean;
90
+ /**
91
+ * Skip the self-crossing sweep while the surface could not have moved far enough to cross itself (default: `true`).
92
+ */
93
+ detectionMotionGating: boolean;
94
+ /**
95
+ * Detect boundary crossings between pairs of soft surfaces (default: `true`).
96
+ */
97
+ crossBodyDetection: boolean;
98
+ /**
99
+ * Self contacts of tangled features stand down, so the elasticity resolves the tangle instead of freezing it (default: `true`).
100
+ */
101
+ selfStandDown: boolean;
102
+ /**
103
+ * A vertex constraint touching a boundary crossing between two surfaces may only expel, never hold (default: `true`).
104
+ */
105
+ crossBodyExpelGate: boolean;
106
+ /**
107
+ * Edge constraints touching a cross-body boundary crossing stand down (default: `true`).
108
+ */
109
+ edgeStandDown: boolean;
110
+ /**
111
+ * Constraints on crossing-flagged features repel instead of standing down (default: `false`).
112
+ */
113
+ crossingRepulsion: boolean;
114
+ /**
115
+ * Guide the crossing repulsion by the pair's volume normal rather than the pierced element's plane normal; closed pairs only (default: `false`).
116
+ */
117
+ crossingRepulsionGuide: boolean;
118
+ /**
119
+ * Guide the self-crossing repulsion by the fold's volume normal; closed meshes only (default: `false`).
120
+ */
121
+ crossingRepulsionSelfGuide: boolean;
122
+ /**
123
+ * Intersection-volume contact for closed surfaces: one coupled constraint per overlapping pair, corrected by the intersection volume (default: `true`).
124
+ */
125
+ overlapConstraints: boolean;
126
+ /**
127
+ * Overlap constraints against rigid colliders too (default: `true`).
128
+ */
129
+ overlapRigid: boolean;
130
+ /**
131
+ * A self-crossed mesh takes no pair constraint, its volume gradient pointing the wrong way there (default: `true`).
132
+ */
133
+ overlapSkipSelfTangled: boolean;
134
+ /**
135
+ * The 3D closed-closed edge constraints stand down on a pair an overlap constraint owns (default: `true`).
136
+ */
137
+ overlapEdgeStandDown: boolean;
138
+ /**
139
+ * Measure the intersection volume on the contact skins instead of the geometric surfaces (default: `false`).
140
+ */
141
+ overlapSkinVolume: boolean;
142
+ /**
143
+ * Volume constraints on a body's self-overlaps between distinct surface regions; closed meshes only (default: `false`).
144
+ */
145
+ overlapSelfRegions: boolean;
146
+ /**
147
+ * Push along each constraint's normal instead of the volume gradients, so the whole patch separates along one axis (default: `true`).
148
+ */
149
+ overlapNormalPush: boolean;
150
+ /**
151
+ * Split each pair's patch into a grid of cells, each with its own constraint, so the pressure varies across the patch (default: `false`).
152
+ */
153
+ overlapMultiVolume: boolean;
154
+ /**
155
+ * Material recovery pace, in length units per second: the corrective rate allowed to deep recovery, demoted intruders and untangling pulls (default: `0.5`).
156
+ */
157
+ recoveryPace: number;
158
+ /**
159
+ * Bound on the velocity change the coupled constraint may hand any side per step, in multiples of `recoveryPace` (default: `1.0`).
160
+ */
161
+ overlapConstraintPace: number;
162
+ /**
163
+ * The skin overlap kept at rest, as a fraction of the pair's skins (default: `0.0`).
164
+ */
165
+ overlapKeptDepth: number;
166
+ /**
167
+ * Relative drop of the overlap estimate that counts as progress for `overlapPatience` (default: `0.02`).
168
+ */
169
+ overlapProgressMargin: number;
170
+ /**
171
+ * Cells per tangent axis of the multi-volume grid (default: `3`).
172
+ */
173
+ overlapSplit: number;
174
+ /**
175
+ * Steps without progress of a pair's volume estimate before its positional correction stands down (default: `240`).
176
+ */
177
+ overlapPatience: number;
178
+ /**
179
+ * What the per-point constraints of the features inside a volume constraint's patch do
180
+ * (default: `AlongNormal`).
181
+ */
182
+ overlapPatchConstraints: SoftPatchConstraints;
183
+ constructor();
184
+ /** @internal */
185
+ static fromRaw(raw: RawSoftRecoverySettings): SoftRecoverySettings;
186
+ /** @internal */
187
+ private static copyFromRaw;
188
+ /** @internal */
189
+ intoRaw(): RawSoftRecoverySettings;
190
+ }
191
+ /**
192
+ * How the vertices of a deformable collider follow the particles of its cluster.
193
+ */
194
+ export declare enum SoftMeshBindingMode {
195
+ /**
196
+ * Vertex `i` of the mesh follows the `i`-th particle of the binding's particle list.
197
+ */
198
+ Direct = 0,
199
+ /**
200
+ * Every vertex follows the particle of the cluster closest to it.
201
+ */
202
+ DirectByPosition = 1,
203
+ /**
204
+ * Every vertex is embedded in the cell of the cluster holding it (cage simulation).
205
+ */
206
+ Skinned = 2
207
+ }
208
+ /**
209
+ * Describes how a deformable collider is bound to the cluster of a soft body.
210
+ */
211
+ export declare class SoftMeshBinding {
212
+ mode: SoftMeshBindingMode;
213
+ /**
214
+ * For `SoftMeshBindingMode.Direct`: the particle followed by each vertex of the mesh.
215
+ */
216
+ particles: Uint32Array;
217
+ /**
218
+ * For `SoftMeshBindingMode.DirectByPosition`: the largest distance between a vertex and
219
+ * the particle it follows.
220
+ */
221
+ eps: number;
222
+ /**
223
+ * Whether the mesh collides with itself.
224
+ */
225
+ selfContacts: boolean;
226
+ constructor(mode: SoftMeshBindingMode);
227
+ /**
228
+ * Binds vertex `i` of the mesh to `particles[i]`, which must belong to the cluster.
229
+ */
230
+ static direct(particles: Uint32Array | number[]): SoftMeshBinding;
231
+ /**
232
+ * Binds every vertex to the particle of the cluster closest to it, within `eps`.
233
+ */
234
+ static directByPosition(eps: number): SoftMeshBinding;
235
+ /**
236
+ * Binds every vertex to the cell of the cluster holding it (cage simulation).
237
+ */
238
+ static skinned(): SoftMeshBinding;
239
+ /**
240
+ * Enables collisions of this mesh with itself.
241
+ */
242
+ setSelfContacts(enabled: boolean): SoftMeshBinding;
243
+ /** @internal */
244
+ rawMode(): RawSoftMeshBindingMode;
245
+ }
246
+ /**
247
+ * Spring coefficients of an elastic constraint: a natural frequency (Hz) and a damping ratio.
248
+ */
249
+ export interface SpringCoefficients {
250
+ naturalFrequency: number;
251
+ dampingRatio: number;
252
+ }
253
+ /**
254
+ * The material of a soft body: the softness of its constraints, its elasticity, plasticity
255
+ * and tearing thresholds.
256
+ *
257
+ * A material is a plain JavaScript object; pass it to `SoftBodyDesc.setMaterial` or
258
+ * `SoftBody.setMaterial` to apply it.
259
+ */
260
+ export declare class SoftBodyMaterial {
261
+ /**
262
+ * Softness of the structural edges.
263
+ */
264
+ edgeSoftness: SpringCoefficients;
265
+ /**
266
+ * Softness of the bending constraints (bend edges and dihedrals).
267
+ */
268
+ bendSoftness: SpringCoefficients;
269
+ /**
270
+ * Softness of the area/volume preservation constraints.
271
+ */
272
+ volumeSoftness: SpringCoefficients;
273
+ /**
274
+ * Softness of the shape-matching constraints.
275
+ */
276
+ shapeMatchingSoftness: SpringCoefficients;
277
+ /**
278
+ * Young's modulus of the elastic cells (Corotational and NeoHookean cell models).
279
+ */
280
+ youngModulus: number;
281
+ /**
282
+ * Poisson's ratio of the elastic cells.
283
+ */
284
+ poissonRatio: number;
285
+ /**
286
+ * Damping ratio of the elastic cells.
287
+ */
288
+ elasticDampingRatio: number;
289
+ /**
290
+ * Strain beyond which the rest shape of an elastic cell flows (`0` disables plasticity).
291
+ */
292
+ plasticYield: number;
293
+ /**
294
+ * Rate (per second) at which an elastic cell's rest shape follows its deformation past the
295
+ * yield.
296
+ */
297
+ plasticCreep: number;
298
+ /**
299
+ * Largest accumulated plastic deformation of an elastic cell.
300
+ */
301
+ plasticMax: number;
302
+ /**
303
+ * Damping of the deformation velocity of the elastic cells.
304
+ */
305
+ deformationDamping: number;
306
+ /**
307
+ * Strain beyond which the rest length of an edge flows (`0` disables edge plasticity).
308
+ */
309
+ edgePlasticYield: number;
310
+ /**
311
+ * Rate (per second) at which an edge's rest length follows its stretch past the yield.
312
+ */
313
+ edgePlasticCreep: number;
314
+ /**
315
+ * Largest relative change of an edge's rest length.
316
+ */
317
+ edgePlasticMax: number;
318
+ /**
319
+ * Which strains make the edge rest lengths flow.
320
+ */
321
+ edgePlasticFlow: SoftEdgePlasticFlow;
322
+ /**
323
+ * Strain beyond which an element tears, or `null` for no strain-based tearing.
324
+ */
325
+ tearStrain: number | null;
326
+ /**
327
+ * Force beyond which an element tears, or `null` for no force-based tearing.
328
+ */
329
+ tearForce: number | null;
330
+ /**
331
+ * Time constant (seconds) of the smoothing applied to the load before comparing it to
332
+ * `tearForce`.
333
+ */
334
+ tearSmoothing: number;
335
+ /**
336
+ * Multiplier of the tear thresholds for the interior elements (relative to the surface).
337
+ */
338
+ interiorStrength: number;
339
+ /**
340
+ * Largest number of elements torn per step.
341
+ */
342
+ maxTearsPerStep: number;
343
+ /**
344
+ * Smallest piece (in elements) a tear may split off, or `null` for the default.
345
+ */
346
+ minPiece: number | null;
347
+ constructor();
348
+ /**
349
+ * A material whose edge, bend, volume and shape-matching softness all take the same value.
350
+ */
351
+ static uniform(naturalFrequency: number, dampingRatio: number): SoftBodyMaterial;
352
+ /** @internal */
353
+ static fromRaw(raw: RawSoftBodyMaterial): SoftBodyMaterial;
354
+ /** @internal */
355
+ private static copyFromRaw;
356
+ /** @internal */
357
+ intoRaw(): RawSoftBodyMaterial;
358
+ }
359
+ /**
360
+ * A soft body: particles linked by elastic constraints (edges, bending constraints and
361
+ * cells), simulated together with the rigid bodies, contacts and joints of the world.
362
+ *
363
+ * A soft body lives in a `SoftBodySet` and is referenced by its integer `handle`. Its hidden
364
+ * root rigid body (`rootBody()`) stands for the whole body in joints and islands; its clusters
365
+ * add more rigid-body proxies that joints and colliders can attach to.
366
+ */
367
+ export declare class SoftBody {
368
+ private rawSet;
369
+ private bodies;
370
+ private colliders;
371
+ readonly handle: SoftBodyHandle;
372
+ /**
373
+ * An arbitrary user-defined object associated with this soft body.
374
+ */
375
+ userData?: unknown;
376
+ constructor(rawSet: RawSoftBodySet, bodies: RigidBodySet, colliders: ColliderSet, handle: SoftBodyHandle);
377
+ /** @internal */
378
+ finalizeDeserialization(bodies: RigidBodySet, colliders: ColliderSet): void;
379
+ /**
380
+ * Checks if this soft body is still valid (i.e. that it has not been deleted from the
381
+ * soft-body set yet).
382
+ */
383
+ isValid(): boolean;
384
+ /**
385
+ * A counter incremented by every change of the body's topology (tears, cuts, splits).
386
+ */
387
+ topologyVersion(): number;
388
+ /**
389
+ * The number of particles of this soft body.
390
+ */
391
+ numParticles(): number;
392
+ /**
393
+ * The world-space position of the `i`-th particle.
394
+ */
395
+ particlePosition(i: number, target?: Vector): Vector;
396
+ /**
397
+ * The world-space positions of every particle, flattened (two or three floats per
398
+ * particle).
399
+ */
400
+ particlePositions(): Float32Array;
401
+ /**
402
+ * The velocity of the `i`-th particle.
403
+ */
404
+ particleVelocity(i: number, target?: Vector): Vector;
405
+ /**
406
+ * The velocities of every particle, flattened (two or three floats per particle).
407
+ */
408
+ particleVelocities(): Float32Array;
409
+ /**
410
+ * The rest position of the `i`-th particle (the position its constraints hold it at).
411
+ */
412
+ particleRestPosition(i: number, target?: Vector): Vector;
413
+ /**
414
+ * The mass of the `i`-th particle.
415
+ */
416
+ particleMass(i: number): number;
417
+ /**
418
+ * Is the `i`-th particle pinned (held in place)?
419
+ */
420
+ isParticlePinned(i: number): boolean;
421
+ /**
422
+ * Does the `i`-th particle lie on the body's surface?
423
+ */
424
+ isParticleOnSurface(i: number): boolean;
425
+ /**
426
+ * Has an element of the `i`-th particle torn?
427
+ */
428
+ isParticleDamaged(i: number): boolean;
429
+ /**
430
+ * Sets the world-space position of the `i`-th particle.
431
+ */
432
+ setParticlePosition(i: number, position: Vector): void;
433
+ /**
434
+ * Sets the velocity of the `i`-th particle.
435
+ */
436
+ setParticleVelocity(i: number, velocity: Vector): void;
437
+ /**
438
+ * Moves the pinned `i`-th particle to `position` over the next step, like a
439
+ * position-based kinematic body (it pushes what it meets), then holds it there.
440
+ * Ignored for a free particle.
441
+ */
442
+ setParticleKinematicTarget(i: number, position: Vector): void;
443
+ /**
444
+ * Pins (or releases) the `i`-th particle.
445
+ */
446
+ setParticlePinned(i: number, pinned: boolean): void;
447
+ /**
448
+ * Attaches the `i`-th particle to a rigid body, at the particle's current position.
449
+ */
450
+ attachParticle(i: number, body: RigidBody): void;
451
+ /**
452
+ * Detaches the `i`-th particle from the rigid body it was attached to.
453
+ *
454
+ * Returns `false` if the particle was not attached.
455
+ */
456
+ detachParticle(i: number): boolean;
457
+ /**
458
+ * The number of particles attached to rigid bodies.
459
+ */
460
+ numAttachments(): number;
461
+ /**
462
+ * The particle of the `i`-th attachment.
463
+ */
464
+ attachmentParticle(i: number): number;
465
+ /**
466
+ * The rigid body of the `i`-th attachment.
467
+ */
468
+ attachmentBody(i: number): RigidBody;
469
+ /**
470
+ * The number of edges (structural and bending) of this soft body.
471
+ */
472
+ numEdges(): number;
473
+ /**
474
+ * The particle pairs of every edge, flattened (two indices per edge).
475
+ */
476
+ edges(): Uint32Array;
477
+ /**
478
+ * The rest length of the `i`-th edge.
479
+ */
480
+ edgeRestLength(i: number): number;
481
+ /**
482
+ * Is the `i`-th edge a bending edge (rather than a structural one)?
483
+ */
484
+ isEdgeBend(i: number): boolean;
485
+ /**
486
+ * The impulse applied by the `i`-th edge during the last step.
487
+ */
488
+ edgeImpulse(i: number): number;
489
+ /**
490
+ * The load of the `i`-th edge relative to its tear threshold (`1` tears it).
491
+ */
492
+ edgeStress(i: number): number;
493
+ /**
494
+ * The relative change of the `i`-th edge's rest length due to plastic flow.
495
+ */
496
+ edgePlasticStrain(i: number): number;
497
+ /**
498
+ * The multiplier of the tear thresholds of the `i`-th edge.
499
+ */
500
+ edgeTearResistance(i: number): number;
501
+ /**
502
+ * The number of cells (triangles in 2D, tetrahedra in 3D) of this soft body.
503
+ */
504
+ numCells(): number;
505
+ /**
506
+ * The particles of every cell, flattened (three indices per cell in 2D, four in 3D).
507
+ */
508
+ cells(): Uint32Array;
509
+ /**
510
+ * The rest area/volume of the `i`-th cell.
511
+ */
512
+ cellRestVolume(i: number): number;
513
+ /**
514
+ * The load of the `i`-th cell relative to its tear threshold (`1` tears it).
515
+ */
516
+ cellStress(i: number): number;
517
+ /**
518
+ * The stiffness multiplier of the `i`-th cell.
519
+ */
520
+ cellStiffnessScale(i: number): number;
521
+ /**
522
+ * The multiplier of the tear thresholds of the `i`-th cell.
523
+ */
524
+ cellTearResistance(i: number): number;
525
+ /**
526
+ * The number of dihedral bending constraints of this soft body.
527
+ */
528
+ numDihedrals(): number;
529
+ /**
530
+ * The particles of every dihedral, flattened (four indices per dihedral: the shared edge,
531
+ * then the two opposite vertices).
532
+ */
533
+ dihedrals(): Uint32Array;
534
+ /**
535
+ * The rest angle of the `i`-th dihedral.
536
+ */
537
+ dihedralRestAngle(i: number): number;
538
+ /**
539
+ * The boundary elements of this soft body (segments in 2D, triangles in 3D), flattened
540
+ * (two or three particle indices per element), oriented outward.
541
+ */
542
+ boundary(): Uint32Array;
543
+ /**
544
+ * A copy of this soft body's material.
545
+ */
546
+ material(): SoftBodyMaterial;
547
+ /**
548
+ * Replaces this soft body's material.
549
+ */
550
+ setMaterial(material: SoftBodyMaterial): void;
551
+ /**
552
+ * The constitutive model of this soft body's cells.
553
+ */
554
+ cellModel(): SoftBodyCellModel;
555
+ /**
556
+ * The solver holding the cells of this soft body together.
557
+ */
558
+ solver(): SoftBodySolver;
559
+ /**
560
+ * Sets the solver holding the cells of this soft body together.
561
+ */
562
+ setSolver(solver: SoftBodySolver): void;
563
+ /**
564
+ * Is the global area/volume preservation of this soft body enabled?
565
+ */
566
+ volumePreservationEnabled(): boolean;
567
+ /**
568
+ * Enables or disables the global area/volume preservation of this soft body.
569
+ */
570
+ enableVolumePreservation(enabled: boolean): void;
571
+ /**
572
+ * The rest area/volume enclosed by this soft body's closed surfaces.
573
+ */
574
+ restVolume(): number;
575
+ /**
576
+ * The current area/volume enclosed by this soft body's closed surfaces.
577
+ */
578
+ volume(): number;
579
+ /**
580
+ * The target volume multiplier of the volume preservation (`> 1` inflates the body).
581
+ */
582
+ volumeFactor(): number;
583
+ /**
584
+ * Sets the target volume multiplier of the volume preservation (`> 1` inflates the body).
585
+ */
586
+ setVolumeFactor(factor: number): void;
587
+ /**
588
+ * The thickness of this soft body's particles.
589
+ */
590
+ particleRadius(): number;
591
+ /**
592
+ * Forgets every plastic deformation: the rest shapes return to their initial values.
593
+ */
594
+ resetPlasticity(): void;
595
+ /**
596
+ * The hidden rigid body standing for this soft body in joints and islands.
597
+ */
598
+ rootBody(): RigidBody;
599
+ /**
600
+ * The soft body this one was split off from by a tear, if any.
601
+ */
602
+ origin(): SoftBodyHandle | null;
603
+ /**
604
+ * The handles of the soft bodies that tears split off from this one.
605
+ */
606
+ pieces(): SoftBodyHandle[];
607
+ /**
608
+ * The center of mass of this soft body's particles.
609
+ */
610
+ centerOfMass(target?: Vector): Vector;
611
+ /**
612
+ * The total mass of this soft body's particles.
613
+ */
614
+ mass(): number;
615
+ /**
616
+ * Is this soft body sleeping?
617
+ */
618
+ isSleeping(): boolean;
619
+ /**
620
+ * Wakes this soft body up.
621
+ */
622
+ wakeUp(): void;
623
+ /**
624
+ * Is this soft body enabled (simulated)?
625
+ */
626
+ isEnabled(): boolean;
627
+ /**
628
+ * Enables or disables this soft body.
629
+ */
630
+ setEnabled(enabled: boolean): void;
631
+ /**
632
+ * Sets the extra internal PGS iterations run per substep for this soft body and
633
+ * everything it touches.
634
+ */
635
+ setAdditionalPgsIterations(iterations: number): void;
636
+ /**
637
+ * The linear damping of this soft body's particles.
638
+ */
639
+ linearDamping(): number;
640
+ /**
641
+ * The gravity scale of this soft body's particles.
642
+ */
643
+ gravityScale(): number;
644
+ /**
645
+ * Adds a force to every particle of this soft body (spread by mass).
646
+ */
647
+ addForce(force: Vector, wakeUp: boolean): void;
648
+ /**
649
+ * Adds a force to the `i`-th particle of this soft body.
650
+ */
651
+ addParticleForce(i: number, force: Vector, wakeUp: boolean): void;
652
+ /**
653
+ * Resets the user forces applied to this soft body's particles.
654
+ */
655
+ resetForces(wakeUp: boolean): void;
656
+ /**
657
+ * Applies an impulse to every particle of this soft body (spread by mass).
658
+ */
659
+ applyImpulse(impulse: Vector, wakeUp: boolean): void;
660
+ /**
661
+ * Applies an impulse to the `i`-th particle of this soft body.
662
+ */
663
+ applyParticleImpulse(i: number, impulse: Vector, wakeUp: boolean): void;
664
+ /**
665
+ * Applies an impulse to the particles within `falloffRadius` of `point`, scaled down
666
+ * linearly with their distance to it (`falloffRadius <= 0` applies it to every particle).
667
+ */
668
+ applyImpulseAtPoint(impulse: Vector, point: Vector, falloffRadius: number, wakeUp: boolean): void;
669
+ /**
670
+ * Applies an impulse of the given magnitude pushing the particles away from `center`
671
+ * (a blast), scaled down linearly up to `falloffRadius`.
672
+ */
673
+ applyRadialImpulse(center: Vector, magnitude: number, falloffRadius: number, wakeUp: boolean): void;
674
+ /**
675
+ * Requests the `i`-th edge to tear at the end of the next step.
676
+ */
677
+ tearEdge(i: number): void;
678
+ /**
679
+ * Requests the `i`-th cell to tear at the end of the next step.
680
+ */
681
+ tearCell(i: number): void;
682
+ /**
683
+ * Are there tears requested for the next step?
684
+ */
685
+ hasPendingTears(): boolean;
686
+ /**
687
+ * The number of cluster slots of this soft body (some may have been removed: see
688
+ * `isClusterLive`).
689
+ */
690
+ numClusters(): number;
691
+ /**
692
+ * Does the `i`-th cluster still exist?
693
+ */
694
+ isClusterLive(i: number): boolean;
695
+ /**
696
+ * The rigid body standing for the `i`-th cluster: joints and colliders attach to it.
697
+ */
698
+ clusterProxy(i: number): RigidBody | null;
699
+ /**
700
+ * The particles of the `i`-th cluster.
701
+ */
702
+ clusterParticles(i: number): Uint32Array;
703
+ /**
704
+ * Does the `i`-th cluster hold its shape by shape matching?
705
+ */
706
+ clusterShapeMatchingEnabled(i: number): boolean;
707
+ /**
708
+ * Enables or disables shape matching on the `i`-th cluster.
709
+ */
710
+ enableClusterShapeMatching(i: number, enabled: boolean): void;
711
+ /**
712
+ * Scales the stiffness of the elements of the `i`-th cluster.
713
+ */
714
+ setClusterStiffnessScale(i: number, scale: number): void;
715
+ /**
716
+ * Overrides the softness of the edges of the `i`-th cluster (`null` restores the
717
+ * material's).
718
+ */
719
+ setClusterEdgeSoftness(i: number, softness: SpringCoefficients | null): void;
720
+ /**
721
+ * Scales the tear thresholds of the elements of the `i`-th cluster.
722
+ */
723
+ setClusterTearResistance(i: number, resistance: number): void;
724
+ /**
725
+ * Pins (or releases) every particle of the `i`-th cluster.
726
+ */
727
+ setClusterPinned(i: number, pinned: boolean): void;
728
+ /**
729
+ * Moves the `i`-th cluster rigidly to the given pose over the next step.
730
+ */
731
+ setClusterKinematicTarget(i: number, translation: Vector, rotation: Rotation): void;
732
+ /**
733
+ * The number of collision meshes held by this soft body's clusters (its own deformable
734
+ * surface included).
735
+ */
736
+ numMeshes(): number;
737
+ /**
738
+ * The cluster holding the `i`-th collision mesh.
739
+ */
740
+ meshCluster(i: number): number | null;
741
+ /**
742
+ * The collider holding the `i`-th collision mesh.
743
+ */
744
+ meshCollider(i: number): Collider | null;
745
+ /**
746
+ * Is the `i`-th collision mesh skinned (embedded in the cells) rather than bound
747
+ * vertex-to-particle?
748
+ */
749
+ isMeshSkinned(i: number): boolean;
750
+ /**
751
+ * Does the `i`-th collision mesh collide?
752
+ */
753
+ meshCollisionEnabled(i: number): boolean;
754
+ /**
755
+ * Does the shape of the `i`-th collision mesh carry the `ORIENTED` flag (see
756
+ * `SoftBodyDesc.setOriented`)?
757
+ */
758
+ isMeshOriented(i: number): boolean;
759
+ /**
760
+ * The world-space vertex positions of the `i`-th collision mesh, flattened.
761
+ */
762
+ meshVertices(i: number): Float32Array;
763
+ /**
764
+ * The elements of the `i`-th collision mesh, flattened (two vertex indices per segment in
765
+ * 2D, three per triangle in 3D).
766
+ */
767
+ meshIndices(i: number): Uint32Array;
768
+ /**
769
+ * The index of the collision mesh held by a deformable collider of this soft body.
770
+ */
771
+ meshOfCollider(collider: Collider): number | null;
772
+ }
773
+ /**
774
+ * The description of a soft body to create.
775
+ *
776
+ * Start from one of the generators (`SoftBodyDesc.rope`, `cloth`, `cuboid`, `sphere`,
777
+ * `trimesh`, `volumetric` in 3D; `rope`, `polygon`, `disk`, `grid`, `polyline`, `volumetric`
778
+ * in 2D) or from raw particle positions, then tune it with the chainable setters. The
779
+ * description holds no WASM memory: it is applied when the soft body is created.
780
+ */
781
+ export declare class SoftBodyDesc {
782
+ private generator;
783
+ private setters;
784
+ /**
785
+ * The material of the soft body, or `null` to keep the default one (with `softness`
786
+ * applied on top when set).
787
+ */
788
+ material: SoftBodyMaterial | null;
789
+ /**
790
+ * A uniform softness applied to every constraint of the material, or `null`.
791
+ */
792
+ softness: SpringCoefficients | null;
793
+ /**
794
+ * The uniform mass of the particles (ignored when `masses` is set).
795
+ */
796
+ particleMass: number;
797
+ /**
798
+ * The total mass of the body, spread over its particles, or `null` to use `particleMass`.
799
+ */
800
+ mass: number | null;
801
+ /**
802
+ * Per-particle masses, or `null` for uniform masses.
803
+ */
804
+ masses: Float32Array | null;
805
+ /**
806
+ * The indices of the pinned particles.
807
+ */
808
+ pinnedParticles: Uint32Array;
809
+ /**
810
+ * The constitutive model of the cells.
811
+ */
812
+ cellModel: SoftBodyCellModel;
813
+ /**
814
+ * The solver holding the cells together.
815
+ */
816
+ solver: SoftBodySolver;
817
+ /**
818
+ * Whether the area/volume enclosed by the body's closed surfaces is preserved (`null`:
819
+ * what the generator chose, off for raw positions).
820
+ */
821
+ volumePreservation: boolean | null;
822
+ /**
823
+ * The target volume multiplier of the volume preservation (`> 1` inflates the body).
824
+ */
825
+ volumeFactor: number;
826
+ /**
827
+ * Whether shape matching holds the body's shape (`null`: what the generator chose, off for
828
+ * raw positions).
829
+ */
830
+ shapeMatching: boolean | null;
831
+ /**
832
+ * Whether the body's surface collides with itself.
833
+ */
834
+ selfContacts: boolean;
835
+ /**
836
+ * Whether the shape of the body's collision surface is built with the `ORIENTED` flag
837
+ * (`null`: whenever the surface is closed).
838
+ */
839
+ oriented: boolean | null;
840
+ /**
841
+ * The thickness of the particles (`null`: what the generator chose).
842
+ */
843
+ particleRadius: number | null;
844
+ /**
845
+ * The template of the body's colliders (their shape is replaced by the body's deformable
846
+ * surface), or `null` for a body without collisions.
847
+ */
848
+ surfaceCollider: ColliderDesc | null;
849
+ /**
850
+ * Whether the body collides through its skin rather than through its cells' boundary.
851
+ */
852
+ skinCollision: boolean;
853
+ /**
854
+ * A translation applied to every particle.
855
+ */
856
+ translation: Vector | null;
857
+ /**
858
+ * Linear damping of the particles.
859
+ */
860
+ linearDamping: number;
861
+ /**
862
+ * Gravity scale of the particles.
863
+ */
864
+ gravityScale: number;
865
+ /**
866
+ * Extra solver substeps requested for the body and everything it touches.
867
+ */
868
+ additionalSolverIterations: number;
869
+ /**
870
+ * Extra internal PGS iterations per substep for the body and everything it touches.
871
+ */
872
+ additionalPgsIterations: number;
873
+ /**
874
+ * Whether the body may fall asleep.
875
+ */
876
+ canSleep: boolean;
877
+ /**
878
+ * The dominance group of the body.
879
+ */
880
+ dominanceGroup: number;
881
+ /**
882
+ * An arbitrary user-defined object associated with the soft body.
883
+ */
884
+ userData?: unknown;
885
+ /**
886
+ * A description over raw world-space particle positions (flattened), with no element:
887
+ * add edges, cells and a surface with the setters.
888
+ */
889
+ constructor(positions?: Float32Array | number[]);
890
+ private static withGenerator;
891
+ /**
892
+ * A rope of `numParticles` particles from `start` to `end`.
893
+ */
894
+ static rope(start: Vector, end: Vector, numParticles: number): SoftBodyDesc;
895
+ /**
896
+ * A body filling the closed surface (segments in 2D, triangles in 3D) with cells of the
897
+ * given size; `skinned` keeps the surface as a skin embedded in the cells. Returns
898
+ * `null` if the surface cannot be meshed.
899
+ *
900
+ * @param vertices - The flattened world-space vertices of the surface.
901
+ * @param indices - The flattened elements of the surface.
902
+ */
903
+ static volumetric(vertices: Float32Array, indices: Uint32Array, cellSize: number, skinned?: boolean): SoftBodyDesc | null;
904
+ /**
905
+ * A triangle-mesh body without cells: the vertices are particles, the triangles the
906
+ * surface, held by dihedral bending and shape matching. Returns `null` if the mesh is
907
+ * empty.
908
+ */
909
+ static trimesh(vertices: Float32Array, indices: Uint32Array): SoftBodyDesc | null;
910
+ /**
911
+ * A cloth of `nu` by `nv` particles: particle `(i, j)` is at `origin + i * du + j * dv`.
912
+ */
913
+ static cloth(origin: Vector, du: Vector, dv: Vector, nu: number, nv: number): SoftBodyDesc;
914
+ /**
915
+ * A tube of cloth around `axis`, from `radiusStart` at `origin` to `radiusEnd` at its
916
+ * other end, with `numAround` particles per ring and `numAlong` rings.
917
+ */
918
+ static clothTube(origin: Vector, axis: Vector, radiusStart: number, radiusEnd: number, numAround: number, numAlong: number): SoftBodyDesc;
919
+ /**
920
+ * A cloth with different softness along `du` (warp), along `dv` (weft) and across the
921
+ * diagonals (shear).
922
+ */
923
+ static clothAnisotropic(origin: Vector, du: Vector, dv: Vector, nu: number, nv: number, warp: SpringCoefficients, weft: SpringCoefficients, shear: SpringCoefficients): SoftBodyDesc;
924
+ /**
925
+ * A box of `nx` by `ny` by `nz` particles filled with tetrahedral cells.
926
+ */
927
+ static cuboid(center: Vector, halfExtents: Vector, nx: number, ny: number, nz: number): SoftBodyDesc;
928
+ /**
929
+ * A hollow sphere: an icosphere surface with `subdivisions` refinement levels, holding
930
+ * its volume (a balloon).
931
+ */
932
+ static sphere(center: Vector, radius: number, subdivisions: number): SoftBodyDesc;
933
+ /**
934
+ * Sets the material of the soft body.
935
+ */
936
+ setMaterial(material: SoftBodyMaterial): SoftBodyDesc;
937
+ /**
938
+ * Sets a uniform softness for every constraint of the material.
939
+ */
940
+ setSoftness(naturalFrequency: number, dampingRatio: number): SoftBodyDesc;
941
+ /**
942
+ * Sets the uniform mass of the particles.
943
+ */
944
+ setParticleMass(mass: number): SoftBodyDesc;
945
+ /**
946
+ * Sets the total mass of the body, spread over its particles.
947
+ */
948
+ setMass(mass: number): SoftBodyDesc;
949
+ /**
950
+ * Sets per-particle masses.
951
+ */
952
+ setMasses(masses: Float32Array | number[]): SoftBodyDesc;
953
+ /**
954
+ * Pins the given particles in place.
955
+ */
956
+ setPinnedParticles(pinned: Uint32Array | number[]): SoftBodyDesc;
957
+ /**
958
+ * Replaces the structural edges (flattened particle pairs).
959
+ */
960
+ setEdges(edges: Uint32Array | number[]): SoftBodyDesc;
961
+ /**
962
+ * Adds structural edges (flattened particle pairs).
963
+ */
964
+ addEdges(edges: Uint32Array | number[]): SoftBodyDesc;
965
+ /**
966
+ * Replaces the bending edges (flattened particle pairs).
967
+ */
968
+ setBendEdges(edges: Uint32Array | number[]): SoftBodyDesc;
969
+ /**
970
+ * Makes every edge resist stretching only (a rope or a net that folds freely).
971
+ */
972
+ setTensionOnly(): SoftBodyDesc;
973
+ /**
974
+ * Replaces the dihedral bending constraints (flattened quadruplets: the shared edge, then
975
+ * the two opposite vertices).
976
+ */
977
+ setDihedrals(dihedrals: Uint32Array | number[]): SoftBodyDesc;
978
+ /**
979
+ * Sets the segments a body without surface collides through (a wire).
980
+ */
981
+ setWire(segments: Uint32Array | number[]): SoftBodyDesc;
982
+ /**
983
+ * Replaces the cells (flattened triangles in 2D, tetrahedra in 3D).
984
+ */
985
+ setCells(cells: Uint32Array | number[]): SoftBodyDesc;
986
+ /**
987
+ * Replaces the boundary elements (flattened segments in 2D, triangles in 3D), oriented
988
+ * outward.
989
+ */
990
+ setSurface(surface: Uint32Array | number[]): SoftBodyDesc;
991
+ /**
992
+ * Sets a skin: a finer mesh (flattened world-space vertices and elements) embedded in the
993
+ * cells, which follows them.
994
+ */
995
+ setSkin(vertices: Float32Array | number[], indices: Uint32Array | number[]): SoftBodyDesc;
996
+ /**
997
+ * Makes the body collide through its skin rather than through its cells' boundary.
998
+ */
999
+ setSkinCollision(enabled: boolean): SoftBodyDesc;
1000
+ /**
1001
+ * Overrides the softness of the given edges.
1002
+ */
1003
+ setEdgeSoftness(edges: Uint32Array | number[], softness: SpringCoefficients[]): SoftBodyDesc;
1004
+ /**
1005
+ * Multiplies the tear thresholds of the given edges.
1006
+ */
1007
+ setEdgeTearResistance(edges: Uint32Array | number[], resistances: Float32Array | number[]): SoftBodyDesc;
1008
+ /**
1009
+ * Sets the constitutive model of the cells.
1010
+ */
1011
+ setCellModel(model: SoftBodyCellModel): SoftBodyDesc;
1012
+ /**
1013
+ * Sets the solver holding the cells together (`SoftBodySolver.Fem` needs cells).
1014
+ */
1015
+ setSolver(solver: SoftBodySolver): SoftBodyDesc;
1016
+ /**
1017
+ * Enables the preservation of the area/volume enclosed by the body's closed surfaces.
1018
+ */
1019
+ setVolumePreservation(enabled: boolean): SoftBodyDesc;
1020
+ /**
1021
+ * Sets the target volume multiplier (`> 1` inflates the body); this also enables the
1022
+ * volume preservation.
1023
+ */
1024
+ setVolumeFactor(factor: number): SoftBodyDesc;
1025
+ /**
1026
+ * Holds the body's shape by shape matching.
1027
+ */
1028
+ setShapeMatching(enabled: boolean): SoftBodyDesc;
1029
+ /**
1030
+ * Makes the body's surface collide with itself.
1031
+ */
1032
+ setSelfContacts(enabled: boolean): SoftBodyDesc;
1033
+ /**
1034
+ * Sets whether the shape of the body's collision surface is built with the `ORIENTED`
1035
+ * flag, like a polyline or mesh. Left unset, it is whenever the surface is closed, which
1036
+ * is what a solid body wants: an oriented closed surface encloses matter, so nothing is
1037
+ * held inside it. Set it to `false` for a shell, whose inner side holds the bodies inside
1038
+ * it.
1039
+ */
1040
+ setOriented(oriented: boolean): SoftBodyDesc;
1041
+ /**
1042
+ * Sets the thickness of the particles.
1043
+ */
1044
+ setParticleRadius(radius: number): SoftBodyDesc;
1045
+ /**
1046
+ * Sets the template of the body's colliders: its friction, restitution, groups, events
1047
+ * and other settings are kept, its shape is replaced by the body's deformable surface.
1048
+ */
1049
+ setSurfaceCollider(collider: ColliderDesc): SoftBodyDesc;
1050
+ /**
1051
+ * Removes the body's colliders: it will not collide with anything.
1052
+ */
1053
+ setNoSurfaceCollider(): SoftBodyDesc;
1054
+ /**
1055
+ * Translates every particle.
1056
+ */
1057
+ setTranslation(translation: Vector): SoftBodyDesc;
1058
+ /**
1059
+ * Sets the linear damping of the particles.
1060
+ */
1061
+ setLinearDamping(damping: number): SoftBodyDesc;
1062
+ /**
1063
+ * Sets the gravity scale of the particles.
1064
+ */
1065
+ setGravityScale(scale: number): SoftBodyDesc;
1066
+ /**
1067
+ * Sets the extra solver substeps requested for the body and everything it touches.
1068
+ */
1069
+ setAdditionalSolverIterations(iterations: number): SoftBodyDesc;
1070
+ /**
1071
+ * Sets the extra internal PGS iterations per substep for the body and everything it
1072
+ * touches (default: `3`).
1073
+ */
1074
+ setAdditionalPgsIterations(iterations: number): SoftBodyDesc;
1075
+ /**
1076
+ * Sets whether the body may fall asleep.
1077
+ */
1078
+ setCanSleep(canSleep: boolean): SoftBodyDesc;
1079
+ /**
1080
+ * Sets the dominance group of the body.
1081
+ */
1082
+ setDominanceGroup(group: number): SoftBodyDesc;
1083
+ /**
1084
+ * Sets the user data associated with the soft body.
1085
+ */
1086
+ setUserData(data: unknown): SoftBodyDesc;
1087
+ /**
1088
+ * Appends the particles and elements of another description to this one.
1089
+ */
1090
+ append(other: SoftBodyDesc): SoftBodyDesc;
1091
+ /**
1092
+ * Builds the WASM-side builder this description stands for. The result must be freed.
1093
+ * @internal
1094
+ */
1095
+ intoRaw(): RawSoftBodyBuilder;
1096
+ /**
1097
+ * The number of particles the description currently generates.
1098
+ */
1099
+ numParticles(): number;
1100
+ /**
1101
+ * The flattened world-space positions of the particles the description generates.
1102
+ */
1103
+ particlePositions(): Float32Array;
1104
+ }
1105
+ /**
1106
+ * The record of a soft body tearing: the elements it lost, the particles the tear split,
1107
+ * the pieces the tear separated into soft bodies of their own, and the clusters and joints
1108
+ * that moved with them.
1109
+ *
1110
+ * Events drained from an `EventQueue` are only valid inside the draining closure; events
1111
+ * returned by `World.tearSoftBody` and `World.cutSoftBody` must be freed with `.free()`.
1112
+ */
1113
+ export declare class SoftBodyTearEvent {
1114
+ raw: RawSoftBodyTearEvent;
1115
+ constructor(raw?: RawSoftBodyTearEvent);
1116
+ free(): void;
1117
+ /**
1118
+ * The soft body that tore.
1119
+ */
1120
+ softBody(): SoftBodyHandle;
1121
+ /**
1122
+ * The particle pairs of the edges that tore, flattened.
1123
+ */
1124
+ tornEdges(): Uint32Array;
1125
+ /**
1126
+ * The particles of the cells that tore, flattened.
1127
+ */
1128
+ tornCells(): Uint32Array;
1129
+ /**
1130
+ * The particle pairs of the edges the tear removed, flattened.
1131
+ */
1132
+ removedEdges(): Uint32Array;
1133
+ /**
1134
+ * The particles the tear split, flattened as `(original, copy)` pairs.
1135
+ */
1136
+ splitParticles(): Uint32Array;
1137
+ /**
1138
+ * The particles the tear inserted.
1139
+ */
1140
+ insertedParticles(): Uint32Array;
1141
+ /**
1142
+ * The particle pairs (flattened) the tear started from.
1143
+ */
1144
+ seeds(): Uint32Array;
1145
+ /**
1146
+ * The number of pieces the tear split off into soft bodies of their own.
1147
+ */
1148
+ numPieces(): number;
1149
+ /**
1150
+ * The soft body the `i`-th piece became.
1151
+ */
1152
+ pieceSoftBody(i: number): SoftBodyHandle;
1153
+ /**
1154
+ * The particles (indices in the torn body) that went into the `i`-th piece.
1155
+ */
1156
+ pieceParticles(i: number): Uint32Array;
1157
+ /**
1158
+ * The clusters that moved into the `i`-th piece, flattened as `(source, destination)`
1159
+ * index pairs.
1160
+ */
1161
+ pieceClusters(i: number): Uint32Array;
1162
+ /**
1163
+ * The number of clusters the tear split.
1164
+ */
1165
+ numClusterSplits(): number;
1166
+ /**
1167
+ * The cluster of the torn body the `i`-th split came from.
1168
+ */
1169
+ clusterSplitSource(i: number): number;
1170
+ /**
1171
+ * The soft body holding the cluster the `i`-th split created.
1172
+ */
1173
+ clusterSplitSoftBody(i: number): SoftBodyHandle;
1174
+ /**
1175
+ * The index of the cluster the `i`-th split created.
1176
+ */
1177
+ clusterSplitCluster(i: number): number;
1178
+ /**
1179
+ * The proxy rigid body of the cluster the `i`-th split created.
1180
+ */
1181
+ clusterSplitProxy(i: number): RigidBodyHandle;
1182
+ /**
1183
+ * Does the cluster the `i`-th split created keep the source cluster's proxy?
1184
+ */
1185
+ clusterSplitKeepsProxy(i: number): boolean;
1186
+ /**
1187
+ * The number of impulse joints the tear moved to another proxy.
1188
+ */
1189
+ numMovedJoints(): number;
1190
+ /**
1191
+ * The `i`-th moved impulse joint.
1192
+ */
1193
+ movedJoint(i: number): number;
1194
+ /**
1195
+ * The proxy the `i`-th moved joint was attached to before the tear.
1196
+ */
1197
+ movedJointFrom(i: number): RigidBodyHandle;
1198
+ /**
1199
+ * The proxy the `i`-th moved joint is attached to after the tear.
1200
+ */
1201
+ movedJointTo(i: number): RigidBodyHandle;
1202
+ /**
1203
+ * Where a particle of the torn body is after the tear: its soft body and index there, or
1204
+ * `null` if the particle was removed.
1205
+ */
1206
+ particleDestination(particle: number): {
1207
+ softBody: SoftBodyHandle;
1208
+ particle: number;
1209
+ } | null;
1210
+ }