@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,681 @@
1
+ import { Vector, Rotation } from "../math";
2
+ import { RawColliderSet, RawShape } from "../raw";
3
+ import { ShapeContact } from "./contact";
4
+ import { PointProjection } from "./point";
5
+ import { Ray, RayIntersection } from "./ray";
6
+ import { ShapeCastHit } from "./toi";
7
+ import { ColliderHandle } from "./collider";
8
+ export declare abstract class Shape {
9
+ abstract intoRaw(): RawShape;
10
+ /**
11
+ * The concrete type of this shape.
12
+ */
13
+ abstract get type(): ShapeType;
14
+ /**
15
+ * instant mode without cache
16
+ */
17
+ static fromRaw(rawSet: RawColliderSet, handle: ColliderHandle): Shape;
18
+ static fromRawShape(rawShape: RawShape): Shape;
19
+ /**
20
+ * Computes the time of impact between two moving shapes.
21
+ *
22
+ * In the returned hit, `witness1` and `normal1` lie on this shape and are expressed in its
23
+ * local-space (relative to `shapePos1` and `shapeRot1`), while `witness2` and `normal2` lie on
24
+ * `shape2` and are expressed in its local-space (relative to `shapePos2` and `shapeRot2`).
25
+ *
26
+ * @param shapePos1 - The initial position of this shape.
27
+ * @param shapeRot1 - The rotation of this shape.
28
+ * @param shapeVel1 - The velocity of this shape.
29
+ * @param shape2 - The second moving shape.
30
+ * @param shapePos2 - The initial position of the second shape.
31
+ * @param shapeRot2 - The rotation of the second shape.
32
+ * @param shapeVel2 - The velocity of the second shape.
33
+ * @param targetDistance − If the shape moves closer to this distance from a collider, a hit
34
+ * will be returned.
35
+ * @param maxToi - The maximum time when the impact can happen.
36
+ * @param stopAtPenetration - If set to `false`, the linear shape-cast won’t immediately stop if
37
+ * the shape is penetrating another shape at its starting point **and** its trajectory is such
38
+ * that it’s on a path to exit that penetration state.
39
+ * @param {ShapeCastHit?} target - The object to be populated. If provided,
40
+ * the function returns this object instead of creating a new one.
41
+ * @returns If the two moving shapes collider at some point along their trajectories, this returns the
42
+ * time at which the two shape collider as well as the contact information during the impact. Returns
43
+ * `null` if the two shapes never collide along their paths.
44
+ */
45
+ castShape(shapePos1: Vector, shapeRot1: Rotation, shapeVel1: Vector, shape2: Shape, shapePos2: Vector, shapeRot2: Rotation, shapeVel2: Vector, targetDistance: number, maxToi: number, stopAtPenetration: boolean, target?: ShapeCastHit): ShapeCastHit | null;
46
+ /**
47
+ * Tests if this shape intersects another shape.
48
+ *
49
+ * @param shapePos1 - The position of this shape.
50
+ * @param shapeRot1 - The rotation of this shape.
51
+ * @param shape2 - The second shape to test.
52
+ * @param shapePos2 - The position of the second shape.
53
+ * @param shapeRot2 - The rotation of the second shape.
54
+ * @returns `true` if the two shapes intersect, `false` if they don’t.
55
+ */
56
+ intersectsShape(shapePos1: Vector, shapeRot1: Rotation, shape2: Shape, shapePos2: Vector, shapeRot2: Rotation): boolean;
57
+ /**
58
+ * Computes one pair of contact points between two shapes.
59
+ *
60
+ * @param shapePos1 - The initial position of this sahpe.
61
+ * @param shapeRot1 - The rotation of this shape.
62
+ * @param shape2 - The second shape.
63
+ * @param shapePos2 - The initial position of the second shape.
64
+ * @param shapeRot2 - The rotation of the second shape.
65
+ * @param prediction - The prediction value, if the shapes are separated by a distance greater than this value, test will fail.
66
+ * @returns `null` if the shapes are separated by a distance greater than prediction, otherwise contact details. The result is given in world-space.
67
+ */
68
+ contactShape(shapePos1: Vector, shapeRot1: Rotation, shape2: Shape, shapePos2: Vector, shapeRot2: Rotation, prediction: number, target?: ShapeContact): ShapeContact | null;
69
+ containsPoint(shapePos: Vector, shapeRot: Rotation, point: Vector): boolean;
70
+ projectPoint(shapePos: Vector, shapeRot: Rotation, point: Vector, solid: boolean, target?: PointProjection): PointProjection;
71
+ intersectsRay(ray: Ray, shapePos: Vector, shapeRot: Rotation, maxToi: number): boolean;
72
+ castRay(ray: Ray, shapePos: Vector, shapeRot: Rotation, maxToi: number, solid: boolean): number;
73
+ castRayAndGetNormal(ray: Ray, shapePos: Vector, shapeRot: Rotation, maxToi: number, solid: boolean, target?: RayIntersection): RayIntersection;
74
+ }
75
+ /**
76
+ * An enumeration representing the type of a shape.
77
+ */
78
+ export declare enum ShapeType {
79
+ Ball = 0,
80
+ Cuboid = 1,
81
+ Capsule = 2,
82
+ Segment = 3,
83
+ Polyline = 4,
84
+ Triangle = 5,
85
+ TriMesh = 6,
86
+ HeightField = 7,
87
+ Compound = 8,
88
+ ConvexPolyhedron = 9,
89
+ Cylinder = 10,
90
+ Cone = 11,
91
+ RoundCuboid = 12,
92
+ RoundTriangle = 13,
93
+ RoundCylinder = 14,
94
+ RoundCone = 15,
95
+ RoundConvexPolyhedron = 16,
96
+ HalfSpace = 17,
97
+ Voxels = 18
98
+ }
99
+ /**
100
+ * Flags controlling the behavior of some operations involving heightfields.
101
+ */
102
+ export declare enum HeightFieldFlags {
103
+ /**
104
+ * If set, a special treatment will be applied to contact manifold calculation to eliminate
105
+ * or fix contacts normals that could lead to incorrect bumps in physics simulation (especially
106
+ * on flat surfaces).
107
+ *
108
+ * This is achieved by taking into account adjacent triangle normals when computing contact
109
+ * points for a given triangle.
110
+ */
111
+ FIX_INTERNAL_EDGES = 1
112
+ }
113
+ /**
114
+ * Flags controlling the behavior of a polyline.
115
+ */
116
+ export declare enum PolylineFlags {
117
+ /**
118
+ * The polyline is deformable: its vertices may be moved after its creation. Required
119
+ * for a polyline used as a soft body's collision mesh (see
120
+ * `World.createDeformableCollider`).
121
+ */
122
+ DEFORMABLE = 2
123
+ }
124
+ /**
125
+ * Flags controlling the behavior of a compound shape.
126
+ */
127
+ export declare enum CompoundFlags {
128
+ /**
129
+ * The edges (2D) or faces (3D) where two parts meet are treated as interior to the
130
+ * union, and contact normals are clamped to the surviving outline. This removes the
131
+ * ledge a body catches on when it slides across the cut between two parts of a convex
132
+ * decomposition. Costs a one-off pass over the parts' edges when set.
133
+ */
134
+ FIX_INTERNAL_EDGES = 1
135
+ }
136
+ /**
137
+ * Flags controlling the behavior of the triangle mesh creation and of some
138
+ * operations involving triangle meshes.
139
+ */
140
+ export declare enum TriMeshFlags {
141
+ /**
142
+ * If set, any triangle that results in a failing half-hedge topology computation will be deleted.
143
+ */
144
+ DELETE_BAD_TOPOLOGY_TRIANGLES = 4,
145
+ /**
146
+ * If set, the trimesh will be assumed to be oriented (with outward normals).
147
+ *
148
+ * The pseudo-normals of its vertices and edges will be computed.
149
+ */
150
+ ORIENTED = 8,
151
+ /**
152
+ * If set, the duplicate vertices of the trimesh will be merged.
153
+ *
154
+ * Two vertices with the exact same coordinates will share the same entry on the
155
+ * vertex buffer and the index buffer is adjusted accordingly.
156
+ */
157
+ MERGE_DUPLICATE_VERTICES = 16,
158
+ /**
159
+ * If set, the triangles sharing two vertices with identical index values will be removed.
160
+ *
161
+ * Because of the way it is currently implemented, this methods implies that duplicate
162
+ * vertices will be merged. It will no longer be the case in the future once we decouple
163
+ * the computations.
164
+ */
165
+ DELETE_DEGENERATE_TRIANGLES = 32,
166
+ /**
167
+ * If set, two triangles sharing three vertices with identical index values (in any order)
168
+ * will be removed.
169
+ *
170
+ * Because of the way it is currently implemented, this methods implies that duplicate
171
+ * vertices will be merged. It will no longer be the case in the future once we decouple
172
+ * the computations.
173
+ */
174
+ DELETE_DUPLICATE_TRIANGLES = 64,
175
+ /**
176
+ * If set, a special treatment will be applied to contact manifold calculation to eliminate
177
+ * or fix contacts normals that could lead to incorrect bumps in physics simulation
178
+ * (especially on flat surfaces).
179
+ *
180
+ * This is achieved by taking into account adjacent triangle normals when computing contact
181
+ * points for a given triangle.
182
+ *
183
+ * /!\ NOT SUPPORTED IN THE 2D VERSION OF RAPIER.
184
+ */
185
+ FIX_INTERNAL_EDGES = 144,
186
+ /**
187
+ * The mesh is deformable: its vertices may be moved after its creation. Required for a
188
+ * triangle mesh used as a soft body's collision mesh (see
189
+ * `World.createDeformableCollider`).
190
+ */
191
+ DEFORMABLE = 256,
192
+ /**
193
+ * Like `FIX_INTERNAL_EDGES`, but a contact coming from the back of a triangle is kept and
194
+ * its normal is constrained by the internal edges too.
195
+ */
196
+ FIX_INTERNAL_EDGES_TWO_SIDED = 656
197
+ }
198
+ /**
199
+ * A shape that is a sphere in 3D and a circle in 2D.
200
+ */
201
+ export declare class Ball extends Shape {
202
+ readonly type = ShapeType.Ball;
203
+ /**
204
+ * The balls radius.
205
+ */
206
+ radius: number;
207
+ /**
208
+ * Creates a new ball with the given radius.
209
+ * @param radius - The balls radius.
210
+ */
211
+ constructor(radius: number);
212
+ intoRaw(): RawShape;
213
+ }
214
+ export declare class HalfSpace extends Shape {
215
+ readonly type = ShapeType.HalfSpace;
216
+ /**
217
+ * The outward normal of the half-space.
218
+ */
219
+ normal: Vector;
220
+ /**
221
+ * Creates a new halfspace delimited by an infinite plane.
222
+ *
223
+ * @param normal - The outward normal of the plane.
224
+ */
225
+ constructor(normal: Vector);
226
+ intoRaw(): RawShape;
227
+ }
228
+ /**
229
+ * A shape that is a box in 3D and a rectangle in 2D.
230
+ */
231
+ export declare class Cuboid extends Shape {
232
+ readonly type = ShapeType.Cuboid;
233
+ /**
234
+ * The half extent of the cuboid along each coordinate axis.
235
+ */
236
+ halfExtents: Vector;
237
+ /**
238
+ * Creates a new 3D cuboid.
239
+ * @param hx - The half width of the cuboid.
240
+ * @param hy - The half height of the cuboid.
241
+ * @param hz - The half depth of the cuboid.
242
+ */
243
+ constructor(hx: number, hy: number, hz: number);
244
+ intoRaw(): RawShape;
245
+ }
246
+ /**
247
+ * A shape that is a box in 3D and a rectangle in 2D, with round corners.
248
+ */
249
+ export declare class RoundCuboid extends Shape {
250
+ readonly type = ShapeType.RoundCuboid;
251
+ /**
252
+ * The half extent of the cuboid along each coordinate axis.
253
+ */
254
+ halfExtents: Vector;
255
+ /**
256
+ * The radius of the cuboid's round border.
257
+ */
258
+ borderRadius: number;
259
+ /**
260
+ * Creates a new 3D cuboid.
261
+ * @param hx - The half width of the cuboid.
262
+ * @param hy - The half height of the cuboid.
263
+ * @param hz - The half depth of the cuboid.
264
+ * @param borderRadius - The radius of the borders of this cuboid. This will
265
+ * effectively increase the half-extents of the cuboid by this radius.
266
+ */
267
+ constructor(hx: number, hy: number, hz: number, borderRadius: number);
268
+ intoRaw(): RawShape;
269
+ }
270
+ /**
271
+ * A shape that is a capsule.
272
+ */
273
+ export declare class Capsule extends Shape {
274
+ readonly type = ShapeType.Capsule;
275
+ /**
276
+ * The radius of the capsule's basis.
277
+ */
278
+ radius: number;
279
+ /**
280
+ * The capsule's half height, along the `y` axis.
281
+ */
282
+ halfHeight: number;
283
+ /**
284
+ * Creates a new capsule with the given radius and half-height.
285
+ * @param halfHeight - The balls half-height along the `y` axis.
286
+ * @param radius - The balls radius.
287
+ */
288
+ constructor(halfHeight: number, radius: number);
289
+ intoRaw(): RawShape;
290
+ }
291
+ /**
292
+ * A shape that is a segment.
293
+ */
294
+ export declare class Segment extends Shape {
295
+ readonly type = ShapeType.Segment;
296
+ /**
297
+ * The first point of the segment.
298
+ */
299
+ a: Vector;
300
+ /**
301
+ * The second point of the segment.
302
+ */
303
+ b: Vector;
304
+ /**
305
+ * Creates a new segment shape.
306
+ * @param a - The first point of the segment.
307
+ * @param b - The second point of the segment.
308
+ */
309
+ constructor(a: Vector, b: Vector);
310
+ intoRaw(): RawShape;
311
+ }
312
+ /**
313
+ * A shape that is a segment.
314
+ */
315
+ export declare class Triangle extends Shape {
316
+ readonly type = ShapeType.Triangle;
317
+ /**
318
+ * The first point of the triangle.
319
+ */
320
+ a: Vector;
321
+ /**
322
+ * The second point of the triangle.
323
+ */
324
+ b: Vector;
325
+ /**
326
+ * The second point of the triangle.
327
+ */
328
+ c: Vector;
329
+ /**
330
+ * Creates a new triangle shape.
331
+ *
332
+ * @param a - The first point of the triangle.
333
+ * @param b - The second point of the triangle.
334
+ * @param c - The third point of the triangle.
335
+ */
336
+ constructor(a: Vector, b: Vector, c: Vector);
337
+ intoRaw(): RawShape;
338
+ }
339
+ /**
340
+ * A shape that is a triangle with round borders and a non-zero thickness.
341
+ */
342
+ export declare class RoundTriangle extends Shape {
343
+ readonly type = ShapeType.RoundTriangle;
344
+ /**
345
+ * The first point of the triangle.
346
+ */
347
+ a: Vector;
348
+ /**
349
+ * The second point of the triangle.
350
+ */
351
+ b: Vector;
352
+ /**
353
+ * The second point of the triangle.
354
+ */
355
+ c: Vector;
356
+ /**
357
+ * The radius of the triangles's rounded edges and vertices.
358
+ * In 3D, this is also equal to half the thickness of the round triangle.
359
+ */
360
+ borderRadius: number;
361
+ /**
362
+ * Creates a new triangle shape with round corners.
363
+ *
364
+ * @param a - The first point of the triangle.
365
+ * @param b - The second point of the triangle.
366
+ * @param c - The third point of the triangle.
367
+ * @param borderRadius - The radius of the borders of this triangle. In 3D,
368
+ * this is also equal to half the thickness of the triangle.
369
+ */
370
+ constructor(a: Vector, b: Vector, c: Vector, borderRadius: number);
371
+ intoRaw(): RawShape;
372
+ }
373
+ /**
374
+ * A shape that is a triangle mesh.
375
+ */
376
+ export declare class Polyline extends Shape {
377
+ readonly type = ShapeType.Polyline;
378
+ /**
379
+ * The vertices of the polyline.
380
+ */
381
+ vertices: Float32Array;
382
+ /**
383
+ * The indices of the segments.
384
+ */
385
+ indices: Uint32Array;
386
+ /**
387
+ * The polyline flags.
388
+ */
389
+ flags: PolylineFlags;
390
+ /**
391
+ * Creates a new polyline shape.
392
+ *
393
+ * @param vertices - The coordinates of the polyline's vertices.
394
+ * @param indices - The indices of the polyline's segments. If this is `null` or not provided, then
395
+ * the vertices are assumed to form a line strip.
396
+ * @param flags - The polyline flags.
397
+ */
398
+ constructor(vertices: Float32Array, indices?: Uint32Array, flags?: PolylineFlags);
399
+ intoRaw(): RawShape;
400
+ }
401
+ /**
402
+ * A shape made of voxels.
403
+ */
404
+ export declare class Voxels extends Shape {
405
+ readonly type = ShapeType.Voxels;
406
+ /**
407
+ * The points or grid coordinates used to initialize the voxels.
408
+ */
409
+ data: Float32Array | Int32Array;
410
+ /**
411
+ * The dimensions of each voxel.
412
+ */
413
+ voxelSize: Vector;
414
+ /**
415
+ * Creates a new shape made of voxels.
416
+ *
417
+ * @param data - Defines the set of voxels. If this is a `Int32Array` then
418
+ * each voxel is defined from its (signed) grid coordinates,
419
+ * with 3 (resp 2) contiguous integers per voxel in 3D (resp 2D).
420
+ * If this is a `Float32Array`, each voxel will be such that
421
+ * they contain at least one point from this array (where each
422
+ * point is defined from 3 (resp 2) contiguous numbers per point
423
+ * in 3D (resp 2D).
424
+ * @param voxelSize - The size of each voxel.
425
+ */
426
+ constructor(data: Float32Array | Int32Array, voxelSize: Vector);
427
+ intoRaw(): RawShape;
428
+ }
429
+ /**
430
+ * A compound shape, consisting of multiple sub-shapes with relative positions.
431
+ */
432
+ export declare class Compound extends Shape {
433
+ readonly type = ShapeType.Compound;
434
+ /**
435
+ * The shapes composing this compound shape.
436
+ */
437
+ shapes: Shape[];
438
+ /**
439
+ * The positions of each sub-shape relative to the compound's origin.
440
+ */
441
+ positions: Vector[];
442
+ /**
443
+ * The rotations of each sub-shape relative to the compound's orientation.
444
+ */
445
+ rotations: Rotation[];
446
+ /**
447
+ * The compound flags.
448
+ */
449
+ flags: CompoundFlags;
450
+ /**
451
+ * Creates a new compound shape.
452
+ *
453
+ * @param shapes - The array of shapes composing this compound. Must not be empty,
454
+ * and must not contain other compound shapes (nested compound shapes
455
+ * are not allowed).
456
+ * @param positions - The array of positions for each shape.
457
+ * @param rotations - The array of rotations for each shape.
458
+ * @param flags - The compound flags.
459
+ */
460
+ constructor(shapes: Shape[], positions: Vector[], rotations: Rotation[], flags?: CompoundFlags);
461
+ /**
462
+ * Reconstructs a compound shape from its raw representation.
463
+ *
464
+ * This takes ownership of `rawShape` and always frees it before returning.
465
+ */
466
+ static fromRawShape(rawShape: RawShape): Compound;
467
+ intoRaw(): RawShape;
468
+ }
469
+ /**
470
+ * A shape that is a triangle mesh.
471
+ */
472
+ export declare class TriMesh extends Shape {
473
+ readonly type = ShapeType.TriMesh;
474
+ /**
475
+ * The vertices of the triangle mesh.
476
+ */
477
+ vertices: Float32Array;
478
+ /**
479
+ * The indices of the triangles.
480
+ */
481
+ indices: Uint32Array;
482
+ /**
483
+ * The triangle mesh flags.
484
+ */
485
+ flags: TriMeshFlags;
486
+ /**
487
+ * Creates a new triangle mesh shape.
488
+ *
489
+ * @param vertices - The coordinates of the triangle mesh's vertices.
490
+ * @param indices - The indices of the triangle mesh's triangles.
491
+ */
492
+ constructor(vertices: Float32Array, indices: Uint32Array, flags?: TriMeshFlags);
493
+ intoRaw(): RawShape;
494
+ }
495
+ /**
496
+ * A shape that is a convex polygon.
497
+ */
498
+ export declare class ConvexPolyhedron extends Shape {
499
+ readonly type = ShapeType.ConvexPolyhedron;
500
+ /**
501
+ * The vertices of the convex polygon.
502
+ */
503
+ vertices: Float32Array;
504
+ /**
505
+ * The indices of the convex polygon.
506
+ */
507
+ indices?: Uint32Array | null;
508
+ /**
509
+ * Creates a new convex polygon shape.
510
+ *
511
+ * @param vertices - The coordinates of the convex polygon's vertices.
512
+ * @param indices - The index buffer of this convex mesh. If this is `null`
513
+ * or `undefined`, the convex-hull of the input vertices will be computed
514
+ * automatically. Otherwise, it will be assumed that the mesh you provide
515
+ * is already convex.
516
+ */
517
+ constructor(vertices: Float32Array, indices?: Uint32Array | null);
518
+ intoRaw(): RawShape;
519
+ }
520
+ /**
521
+ * A shape that is a convex polygon.
522
+ */
523
+ export declare class RoundConvexPolyhedron extends Shape {
524
+ readonly type = ShapeType.RoundConvexPolyhedron;
525
+ /**
526
+ * The vertices of the convex polygon.
527
+ */
528
+ vertices: Float32Array;
529
+ /**
530
+ * The indices of the convex polygon.
531
+ */
532
+ indices?: Uint32Array;
533
+ /**
534
+ * The radius of the convex polyhedron's rounded edges and vertices.
535
+ */
536
+ borderRadius: number;
537
+ /**
538
+ * Creates a new convex polygon shape.
539
+ *
540
+ * @param vertices - The coordinates of the convex polygon's vertices.
541
+ * @param indices - The index buffer of this convex mesh. If this is `null`
542
+ * or `undefined`, the convex-hull of the input vertices will be computed
543
+ * automatically. Otherwise, it will be assumed that the mesh you provide
544
+ * is already convex.
545
+ * @param borderRadius - The radius of the borders of this convex polyhedron.
546
+ */
547
+ constructor(vertices: Float32Array, indices: Uint32Array | null | undefined, borderRadius: number);
548
+ intoRaw(): RawShape;
549
+ }
550
+ /**
551
+ * A shape that is a heightfield.
552
+ */
553
+ export declare class Heightfield extends Shape {
554
+ readonly type = ShapeType.HeightField;
555
+ /**
556
+ * The number of rows in the heights matrix.
557
+ */
558
+ nrows: number;
559
+ /**
560
+ * The number of columns in the heights matrix.
561
+ */
562
+ ncols: number;
563
+ /**
564
+ * The heights of the heightfield along its local `y` axis,
565
+ * provided as a matrix stored in column-major order.
566
+ */
567
+ heights: Float32Array;
568
+ /**
569
+ * The dimensions of the heightfield's local `x,z` plane.
570
+ */
571
+ scale: Vector;
572
+ /**
573
+ * Flags applied to the heightfield.
574
+ */
575
+ flags: HeightFieldFlags;
576
+ /**
577
+ * Creates a new heightfield shape.
578
+ *
579
+ * @param nrows − The number of rows in the heights matrix.
580
+ * @param ncols - The number of columns in the heights matrix.
581
+ * @param heights - The heights of the heightfield along its local `y` axis,
582
+ * provided as a matrix stored in column-major order.
583
+ * @param scale - The dimensions of the heightfield's local `x,z` plane.
584
+ */
585
+ constructor(nrows: number, ncols: number, heights: Float32Array, scale: Vector, flags?: HeightFieldFlags);
586
+ intoRaw(): RawShape;
587
+ }
588
+ /**
589
+ * A shape that is a 3D cylinder.
590
+ */
591
+ export declare class Cylinder extends Shape {
592
+ readonly type = ShapeType.Cylinder;
593
+ /**
594
+ * The radius of the cylinder's basis.
595
+ */
596
+ radius: number;
597
+ /**
598
+ * The cylinder's half height, along the `y` axis.
599
+ */
600
+ halfHeight: number;
601
+ /**
602
+ * Creates a new cylinder with the given radius and half-height.
603
+ * @param halfHeight - The balls half-height along the `y` axis.
604
+ * @param radius - The balls radius.
605
+ */
606
+ constructor(halfHeight: number, radius: number);
607
+ intoRaw(): RawShape;
608
+ }
609
+ /**
610
+ * A shape that is a 3D cylinder with round corners.
611
+ */
612
+ export declare class RoundCylinder extends Shape {
613
+ readonly type = ShapeType.RoundCylinder;
614
+ /**
615
+ * The radius of the cylinder's basis.
616
+ */
617
+ radius: number;
618
+ /**
619
+ * The cylinder's half height, along the `y` axis.
620
+ */
621
+ halfHeight: number;
622
+ /**
623
+ * The radius of the cylinder's rounded edges and vertices.
624
+ */
625
+ borderRadius: number;
626
+ /**
627
+ * Creates a new cylinder with the given radius and half-height.
628
+ * @param halfHeight - The balls half-height along the `y` axis.
629
+ * @param radius - The balls radius.
630
+ * @param borderRadius - The radius of the borders of this cylinder.
631
+ */
632
+ constructor(halfHeight: number, radius: number, borderRadius: number);
633
+ intoRaw(): RawShape;
634
+ }
635
+ /**
636
+ * A shape that is a 3D cone.
637
+ */
638
+ export declare class Cone extends Shape {
639
+ readonly type = ShapeType.Cone;
640
+ /**
641
+ * The radius of the cone's basis.
642
+ */
643
+ radius: number;
644
+ /**
645
+ * The cone's half height, along the `y` axis.
646
+ */
647
+ halfHeight: number;
648
+ /**
649
+ * Creates a new cone with the given radius and half-height.
650
+ * @param halfHeight - The balls half-height along the `y` axis.
651
+ * @param radius - The balls radius.
652
+ */
653
+ constructor(halfHeight: number, radius: number);
654
+ intoRaw(): RawShape;
655
+ }
656
+ /**
657
+ * A shape that is a 3D cone with round corners.
658
+ */
659
+ export declare class RoundCone extends Shape {
660
+ readonly type = ShapeType.RoundCone;
661
+ /**
662
+ * The radius of the cone's basis.
663
+ */
664
+ radius: number;
665
+ /**
666
+ * The cone's half height, along the `y` axis.
667
+ */
668
+ halfHeight: number;
669
+ /**
670
+ * The radius of the cylinder's rounded edges and vertices.
671
+ */
672
+ borderRadius: number;
673
+ /**
674
+ * Creates a new cone with the given radius and half-height.
675
+ * @param halfHeight - The balls half-height along the `y` axis.
676
+ * @param radius - The balls radius.
677
+ * @param borderRadius - The radius of the borders of this cone.
678
+ */
679
+ constructor(halfHeight: number, radius: number, borderRadius: number);
680
+ intoRaw(): RawShape;
681
+ }