@perplexdotgg/bounce 1.6.1 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/build/bounce.d.ts +321 -152
- package/build/bounce.js +14586 -15782
- package/docs/documentation.md +14 -16
- package/package.json +5 -5
- package/tsconfig.json +2 -2
- package/vite.config.js +0 -1
package/build/bounce.d.ts
CHANGED
|
@@ -35,6 +35,11 @@ export declare class Aabb extends Aabb_base {
|
|
|
35
35
|
computeLargestComponent(): "x" | "y" | "z";
|
|
36
36
|
computeCentroid(out: Vec3): Vec3;
|
|
37
37
|
computeHalfExtents(out: Vec3): void;
|
|
38
|
+
/**
|
|
39
|
+
* expand this aabb to include the given point
|
|
40
|
+
* @param point the vec3 to expand to. meaning if the point is outside the aabb, it will expand to include the point
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
38
43
|
expandToPoint(point: Vec3): this;
|
|
39
44
|
enclosesAabb(aabb: Aabb): boolean;
|
|
40
45
|
expandByVector(vector: Vec3): void;
|
|
@@ -81,8 +86,6 @@ export declare const enum ActiveEdgeMode {
|
|
|
81
86
|
CollideWithAll = 1
|
|
82
87
|
}
|
|
83
88
|
|
|
84
|
-
declare function addFlag(flag: number, value: number): number;
|
|
85
|
-
|
|
86
89
|
export declare const AllFlag: number;
|
|
87
90
|
|
|
88
91
|
declare class AngleComponent extends AngleComponent_base {
|
|
@@ -271,65 +274,155 @@ scale: number;
|
|
|
271
274
|
|
|
272
275
|
declare class Body_2 extends Body_base {
|
|
273
276
|
world: World | null;
|
|
277
|
+
/** The current shape of the body. */
|
|
274
278
|
get shape(): Shape | null;
|
|
275
279
|
set shape(newShape: Shape);
|
|
276
|
-
|
|
280
|
+
/** Mainly for internal use. Sets the shape of the body. Typically you should use body.shape = newShape; */
|
|
281
|
+
setShape(newShape: Shape | null, shouldUpdateBody?: boolean): void;
|
|
277
282
|
/**
|
|
278
|
-
*
|
|
283
|
+
* Mainly for internal use. Integrates the linear velocity of a body
|
|
279
284
|
*/
|
|
280
285
|
applyLinearVelocityIntegration(timeStepSizeSeconds: number): void;
|
|
281
286
|
applyAngularVelocityIntegration(timeStepSizeSeconds: number): void;
|
|
282
287
|
/**
|
|
283
|
-
*
|
|
288
|
+
* Mainly for internal use. Applies gravity to a body
|
|
284
289
|
*/
|
|
285
290
|
applyAccelerationIntegration(timeStepSizeSeconds: number, gravity: Vec3, isGravityEnabled: boolean, linearDamping: number, angularDamping: number, maxLinearSpeed: number, maxLinearSpeedSquared: number, maxAngularSpeed: number, maxAngularSpeedSquared: number): void;
|
|
291
|
+
/**
|
|
292
|
+
* Mainly for internal use. Subtracts a rotation delta from the body's orientation.
|
|
293
|
+
*/
|
|
286
294
|
subRotationDelta(rotationDelta: Vec3): void;
|
|
287
295
|
addRotationDelta(rotationDelta: Vec3): void;
|
|
296
|
+
/** Mainly for internal use. Applies a rotation impulse to the body. */
|
|
288
297
|
addRotationPositionImpulse(impulse: Vec3, inverseEffectiveMass: Mat3): void;
|
|
298
|
+
/** Mainly for internal use. Subtracts a rotation impulse from the body's orientation. */
|
|
289
299
|
subRotationPositionImpulse(impulse: Vec3, inverseEffectiveMass: Mat3): void;
|
|
300
|
+
/** Computes the velocity of a point on the body, mainly for internal use but can be useful for spawning debris with the right velocity as well. */
|
|
290
301
|
computePointVelocity(out: Vec3, point: Vec3): void;
|
|
302
|
+
/** Mainly for internal use. Computes the effective inverse inertia vector of the body. */
|
|
291
303
|
computeEffectiveInverseInertiaVector(out: Vec3, rotation: Quat, axis: Vec3): void;
|
|
304
|
+
/** Mainly for internal use. Computes the inverse inertia tensor of the body. */
|
|
292
305
|
computeInverseInertiaTensor(out: Mat3): void;
|
|
306
|
+
/** Mainly for internal use. Computes the velocity of a point relative to the center of mass. */
|
|
293
307
|
computeVelocityOfPointRelativeToCenterOfMass(out: Vec3, point: Vec3): void;
|
|
308
|
+
/** Mainly for internal use. Computes the inverse effective mass of the body in a given direction. */
|
|
294
309
|
computeInverseEffectiveMass(direction: Vec3): number;
|
|
310
|
+
/** Mainly for internal use. Damps the linear velocity of the body. */
|
|
295
311
|
dampLinearVelocity(timeStepSizeSeconds: number, linearDamping: number): void;
|
|
312
|
+
/** Mainly for internal use. Damps the angular velocity of the body. */
|
|
296
313
|
dampAngularVelocity(timeStepSizeSeconds: number, angularDamping: number): void;
|
|
314
|
+
/** Mainly for internal use. Clamps the linear velocity of the body. */
|
|
297
315
|
clampLinearVelocity(maxSpeed: number, maxSpeedSquared: number): void;
|
|
316
|
+
/** Mainly for internal use. Clamps the angular velocity of the body. */
|
|
298
317
|
clampAngularVelocity(maxSpeed: number, maxSpeedSquared: number): void;
|
|
299
|
-
/**
|
|
300
|
-
* direction is in world space
|
|
301
|
-
*/
|
|
318
|
+
/** Mainly for internal use. Computes the supporting face of the body in a given direction. */
|
|
302
319
|
computeSupportingFace(out: Face, subShapeId: number, direction: Vec3, baseOffset: Vec3): void;
|
|
320
|
+
/** Mainly for internal use. Computes the world space surface normal of the body at a given position. */
|
|
303
321
|
computeWorldSpaceSurfaceNormal(outWorldSpaceNormal: Vec3, inWorldSpacePosition: Vec3, subShapeId?: number): void;
|
|
322
|
+
/** Mainly for internal use. Checks if the body has changed since the last commit. */
|
|
304
323
|
hasChanged(): boolean;
|
|
324
|
+
/** Commits the changes of the body, you should call this after changing the position, orientation or mass properties */
|
|
305
325
|
commitChanges(): void;
|
|
326
|
+
/** Applies a linear force to the body. */
|
|
306
327
|
applyLinearForce(force: Vec3): void;
|
|
328
|
+
/** Applies an angular force to the body. */
|
|
307
329
|
applyAngularForce(force: Vec3): void;
|
|
330
|
+
/** Applies a force to the body at a given point. useLocalFrame determines if the point is in local or world space (defaults to world space). */
|
|
308
331
|
applyForce(force: Vec3, point: Vec3, useLocalFrame?: boolean): void;
|
|
332
|
+
/** Applies a linear impulse to the body. */
|
|
309
333
|
applyLinearImpulse(impulse: Vec3): void;
|
|
334
|
+
/** Applies an angular impulse to the body. */
|
|
310
335
|
applyAngularImpulse(impulse: Vec3): void;
|
|
336
|
+
/** Applies an impulse to the body at a given point. useLocalFrame determines if the point is in local or world space (defaults to world space). */
|
|
311
337
|
applyImpulse(impulse: Vec3, point: Vec3, useLocalFrame?: boolean): void;
|
|
338
|
+
/** Clears the linear forces applied to the body. */
|
|
312
339
|
clearLinearForces(): void;
|
|
340
|
+
/** Clears the angular forces applied to the body. */
|
|
313
341
|
clearAngularForces(): void;
|
|
342
|
+
/** Clears both linear and angular forces applied to the body. */
|
|
314
343
|
clearForces(): void;
|
|
344
|
+
/** Mainly for internal use.Checks if the body is ready to sleep based on the sleep time threshold. */
|
|
315
345
|
isReadyToSleep(sleepTimeThreshold: number): boolean;
|
|
316
346
|
sleep(): void;
|
|
317
347
|
wakeUp(): void;
|
|
318
348
|
markBodyAsDirty(): void;
|
|
349
|
+
updateCenterOfMassPosition(): void;
|
|
350
|
+
updateWorldBounds(): void;
|
|
319
351
|
}
|
|
320
352
|
export { Body_2 as Body }
|
|
321
353
|
|
|
322
354
|
declare const Body_base: Monomorph<Body_2, ConvertedInputPropertyDefinitionMap<{
|
|
355
|
+
/** BodyType.static, BodyType.kinematic or BodyType.dynamic */
|
|
323
356
|
type: PropertyDefinition_2<BodyType, true>;
|
|
357
|
+
/** Position of the body's center in world space
|
|
358
|
+
* @default { x: 0, y: 0, z: 0 }
|
|
359
|
+
*/
|
|
324
360
|
position: typeof Vec3;
|
|
361
|
+
/** Orientation of the body in world space. Accepts both quat and eul angle (treated as XYZ order) as input when using .create(), .set() and .reset().
|
|
362
|
+
* @default { x: 0, y: 0, z: 0, w: 1 }
|
|
363
|
+
*/
|
|
325
364
|
orientation: typeof Quat;
|
|
365
|
+
/** Linear velocity of the body
|
|
366
|
+
* @default { x: 0, y: 0, z: 0 }
|
|
367
|
+
*/
|
|
326
368
|
linearVelocity: typeof Vec3;
|
|
369
|
+
/** Angular velocity of the body
|
|
370
|
+
* @default { x: 0, y: 0, z: 0 }
|
|
371
|
+
*/
|
|
327
372
|
angularVelocity: typeof Vec3;
|
|
373
|
+
/** Coefficient of friction of the body, typically between 0 and 1.
|
|
374
|
+
* @default the friction value set in the world options (which itself defaults to 0.5)
|
|
375
|
+
*/
|
|
376
|
+
friction: number;
|
|
377
|
+
/** Whether to use the minimum, maximum or average (default) value for friction between the two bodies involved in a collision
|
|
378
|
+
* @default CoefficientFunctionType.average
|
|
379
|
+
*/
|
|
380
|
+
frictionFunction: PropertyDefinition_2<CoefficientFunctionType, true>;
|
|
381
|
+
/** Coefficient of restitution of the body, typically between 0 and 1. 0 means no bounciness or elasticity. 1 means full bouncy or elastic.
|
|
382
|
+
* @default the restitution value set in the world options (which itself defaults to 0.5)
|
|
383
|
+
*/
|
|
384
|
+
restitution: number;
|
|
385
|
+
/** Whether to use the minimum, maximum or average (default) value for restitution between the two bodies involved in a collision
|
|
386
|
+
* @default CoefficientFunctionType.average
|
|
387
|
+
*/
|
|
388
|
+
restitutionFunction: PropertyDefinition_2<CoefficientFunctionType, true>;
|
|
389
|
+
/** Whether the body is currently sleeping (this is automatically managed) */
|
|
390
|
+
isSleeping: PropertyDefinitionBoolean<true>;
|
|
391
|
+
/** Scale factor for gravity applied to the body. Set to 0 to disable gravity on this body. */
|
|
392
|
+
gravityScale: number;
|
|
393
|
+
/** Density of the body in kilograms per cubic meter. If unspecified, density will be derived from the body's mass and its shape's volume */
|
|
394
|
+
density: number;
|
|
395
|
+
/** Mass of the body in kilograms. Mass is automatically derived from the body's density and its shape's volume, unless the density is set to 0, in which case, the density is derived from the mass. */
|
|
396
|
+
mass: number;
|
|
397
|
+
/** Collision groups the body belongs to
|
|
398
|
+
* @default AllFlag, which means the body belongs to all groups
|
|
399
|
+
*/
|
|
400
|
+
belongsToGroups: PropertyDefinitionNumber<true>;
|
|
401
|
+
/** Collision groups the body can collide with
|
|
402
|
+
* @default AllFlag, which means the body can collide with all groups
|
|
403
|
+
*/
|
|
404
|
+
collidesWithGroups: PropertyDefinitionNumber<true>;
|
|
405
|
+
/** Whether the body is allowed to sleep
|
|
406
|
+
* @default true
|
|
407
|
+
*/
|
|
408
|
+
isSleepingEnabled: PropertyDefinitionBoolean<true>;
|
|
409
|
+
/** Linear damping applied to the body. Set to a negative value to use the world's default linear damping
|
|
410
|
+
* @default -1, which means to use the world's default linear damping
|
|
411
|
+
*/
|
|
412
|
+
linearDamping: number;
|
|
413
|
+
/** Angular damping applied to the body. Set to a negative value to use the world's default angular damping.
|
|
414
|
+
* @default -1, which means to use the world's default angular damping
|
|
415
|
+
*/
|
|
416
|
+
angularDamping: number;
|
|
417
|
+
/** Mainly for internal use. Time the body has been without moving, automatically maintained and used for sleep detection */
|
|
418
|
+
timeWithoutMoving: PropertyDefinitionNumber<true>;
|
|
419
|
+
/** Mainly for internal use. Computed center of mass position in world space. This is automatically updated when the body's shape, position or orientation changes (after commitChanged is called) */
|
|
328
420
|
computedCenterOfMassPosition: PropertyDefinition_2<NoInfer<number[] | {
|
|
329
421
|
x?: number;
|
|
330
422
|
y?: number;
|
|
331
423
|
z?: number;
|
|
332
424
|
} | undefined>, true, typeof Vec3>;
|
|
425
|
+
/** Mainly for internal use. Computed axis-aligned bounding box of the body in world space. This is automatically updated when the body's shape, position or orientation changes (after commitChanged is called) */
|
|
333
426
|
computedBounds: PropertyDefinition_2<NoInfer<PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap<{
|
|
334
427
|
min: typeof Vec3;
|
|
335
428
|
max: typeof Vec3;
|
|
@@ -339,6 +432,7 @@ y?: number;
|
|
|
339
432
|
z?: number;
|
|
340
433
|
} | undefined>, true, typeof Vec3>;
|
|
341
434
|
}>> | undefined>, true, typeof Aabb>;
|
|
435
|
+
/** Mainly for internal use. Computed expanded axis-aligned bounding box of the body in world space. This is automatically updated when the body's shape, position or orientation changes (after commitChanged is called) */
|
|
342
436
|
computedExpandedBounds: PropertyDefinition_2<NoInfer<PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap<{
|
|
343
437
|
min: typeof Vec3;
|
|
344
438
|
max: typeof Vec3;
|
|
@@ -348,21 +442,31 @@ y?: number;
|
|
|
348
442
|
z?: number;
|
|
349
443
|
} | undefined>, true, typeof Vec3>;
|
|
350
444
|
}>> | undefined>, true, typeof Aabb>;
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
445
|
+
/** Mainly for internal use. */
|
|
446
|
+
/** Mainly for internal use. */
|
|
447
|
+
/** Mainly for internal use. This is the type of the current shape, e.g. sphere, box, etc */
|
|
448
|
+
shapeType: PropertyDefinition_2<ShapeType, true>;
|
|
449
|
+
/** Mainly for internal use. References to the specific shape instances based on the shape type */
|
|
450
|
+
shape0: PropertyDefinitionReference<Box | null, true>;
|
|
451
|
+
/** Mainly for internal use. References to the specific shape instances based on the shape type */
|
|
452
|
+
shape1: PropertyDefinitionReference<Capsule | null, true>;
|
|
453
|
+
/** Mainly for internal use. References to the specific shape instances based on the shape type */
|
|
454
|
+
shape2: PropertyDefinitionReference<CompoundShape | null, true>;
|
|
455
|
+
/** Mainly for internal use. References to the specific shape instances based on the shape type */
|
|
456
|
+
shape3: PropertyDefinitionReference<ConvexHull | null, true>;
|
|
457
|
+
/** Mainly for internal use. References to the specific shape instances based on the shape type */
|
|
458
|
+
shape4: PropertyDefinitionReference<Cylinder | null, true>;
|
|
459
|
+
/** Mainly for internal use. References to the specific shape instances based on the shape type */
|
|
460
|
+
shape5: PropertyDefinitionReference<HeightMap | null, true>;
|
|
461
|
+
/** Mainly for internal use. References to the specific shape instances based on the shape type */
|
|
462
|
+
shape6: PropertyDefinitionReference<Sphere | null, true>;
|
|
463
|
+
/** Mainly for internal use. References to the specific shape instances based on the shape type */
|
|
464
|
+
shape7: PropertyDefinitionReference<TriangleMesh | null, true>;
|
|
465
|
+
/** Mainly for internal use. Used for tracking sleep islands */
|
|
466
|
+
sleepVisitGeneration: PropertyDefinitionNumber<true>;
|
|
467
|
+
/** Mainly for internal use. Inverse mass of the body in kilograms. This is automatically derived from the body's mass. */
|
|
365
468
|
inverseMass: PropertyDefinitionNumber<true>;
|
|
469
|
+
/** Mainly for internal use. Computed local inverse inertia tensor of the body. This is automatically updated when the body's shape changes (after commitChanged is called) */
|
|
366
470
|
computedLocalInverseInertia: PropertyDefinition_2<NoInfer<PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap<{
|
|
367
471
|
e0: number;
|
|
368
472
|
e1: number;
|
|
@@ -374,6 +478,7 @@ e6: number;
|
|
|
374
478
|
e7: number;
|
|
375
479
|
e8: number;
|
|
376
480
|
}>> | undefined>, true, typeof Mat3>;
|
|
481
|
+
/** Mainly for internal use. Computed world inverse inertia tensor of the body. This is automatically updated when the body's shape, position or orientation changes (after commitChanged is called) */
|
|
377
482
|
computedWorldInverseInertia: PropertyDefinition_2<NoInfer<PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap<{
|
|
378
483
|
e0: number;
|
|
379
484
|
e1: number;
|
|
@@ -385,48 +490,96 @@ e6: number;
|
|
|
385
490
|
e7: number;
|
|
386
491
|
e8: number;
|
|
387
492
|
}>> | undefined>, true, typeof Mat3>;
|
|
388
|
-
|
|
389
|
-
gravityScale: number;
|
|
493
|
+
/** Mainly for internal use. Accumulated linear forces applied to the body. Typically you would use applyForce or applyImpulse instead of directly modifying this property. */
|
|
390
494
|
linearForces: PropertyDefinition_2<NoInfer<number[] | {
|
|
391
495
|
x?: number;
|
|
392
496
|
y?: number;
|
|
393
497
|
z?: number;
|
|
394
498
|
} | undefined>, true, typeof Vec3>;
|
|
499
|
+
/** Mainly for internal use. Accumulated angular forces applied to the body.Typically you would use applyForce or applyImpulse instead of directly modifying this property. */
|
|
395
500
|
angularForces: PropertyDefinition_2<NoInfer<number[] | {
|
|
396
501
|
x?: number;
|
|
397
502
|
y?: number;
|
|
398
503
|
z?: number;
|
|
399
504
|
} | undefined>, true, typeof Vec3>;
|
|
505
|
+
/** Mainly for internal use. Copy of the body used to check what has changed when commiting changes. */
|
|
400
506
|
copyForDiff: PropertyDefinitionReference<NoInfer<Body_2> | null, true>;
|
|
507
|
+
/** Mainly for internal use. A linked list of contact pair references for the body, to allow us to quickly destroy them when the body is destroyed. */
|
|
401
508
|
firstPotentialPairEdge: PropertyDefinitionReference<NoInfer<BodyPairEdge> | null, true>;
|
|
402
|
-
|
|
403
|
-
collidesWithGroups: PropertyDefinitionNumber<true>;
|
|
404
|
-
node: PropertyDefinitionReference<NoInfer<BvhNode> | null, true>;
|
|
405
|
-
shapeType: PropertyDefinition_2<ShapeType, true>;
|
|
406
|
-
shape0: PropertyDefinitionReference<Box | null, true>;
|
|
407
|
-
shape1: PropertyDefinitionReference<Capsule | null, true>;
|
|
408
|
-
shape2: PropertyDefinitionReference<CompoundShape | null, true>;
|
|
409
|
-
shape3: PropertyDefinitionReference<ConvexHull | null, true>;
|
|
410
|
-
shape4: PropertyDefinitionReference<Cylinder | null, true>;
|
|
411
|
-
shape5: PropertyDefinitionReference<HeightMap | null, true>;
|
|
412
|
-
shape6: PropertyDefinitionReference<Sphere | null, true>;
|
|
413
|
-
shape7: PropertyDefinitionReference<TriangleMesh | null, true>;
|
|
414
|
-
isSleepingEnabled: PropertyDefinitionBoolean<true>;
|
|
415
|
-
linearDamping: number;
|
|
416
|
-
angularDamping: number;
|
|
509
|
+
/** Mainly for internal use. A linked list of constraint pair references for the body, to allow us to quickly destroy them when the body is destroyed. */
|
|
417
510
|
firstPotentialConstraintPairEdge: PropertyDefinitionReference<NoInfer<ConstraintPairEdge> | null, true>;
|
|
418
|
-
visitGeneration: PropertyDefinitionNumber<true>;
|
|
419
511
|
}>, PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap<{
|
|
512
|
+
/** BodyType.static, BodyType.kinematic or BodyType.dynamic */
|
|
420
513
|
type: PropertyDefinition_2<BodyType, true>;
|
|
514
|
+
/** Position of the body's center in world space
|
|
515
|
+
* @default { x: 0, y: 0, z: 0 }
|
|
516
|
+
*/
|
|
421
517
|
position: typeof Vec3;
|
|
518
|
+
/** Orientation of the body in world space. Accepts both quat and eul angle (treated as XYZ order) as input when using .create(), .set() and .reset().
|
|
519
|
+
* @default { x: 0, y: 0, z: 0, w: 1 }
|
|
520
|
+
*/
|
|
422
521
|
orientation: typeof Quat;
|
|
522
|
+
/** Linear velocity of the body
|
|
523
|
+
* @default { x: 0, y: 0, z: 0 }
|
|
524
|
+
*/
|
|
423
525
|
linearVelocity: typeof Vec3;
|
|
526
|
+
/** Angular velocity of the body
|
|
527
|
+
* @default { x: 0, y: 0, z: 0 }
|
|
528
|
+
*/
|
|
424
529
|
angularVelocity: typeof Vec3;
|
|
530
|
+
/** Coefficient of friction of the body, typically between 0 and 1.
|
|
531
|
+
* @default the friction value set in the world options (which itself defaults to 0.5)
|
|
532
|
+
*/
|
|
533
|
+
friction: number;
|
|
534
|
+
/** Whether to use the minimum, maximum or average (default) value for friction between the two bodies involved in a collision
|
|
535
|
+
* @default CoefficientFunctionType.average
|
|
536
|
+
*/
|
|
537
|
+
frictionFunction: PropertyDefinition_2<CoefficientFunctionType, true>;
|
|
538
|
+
/** Coefficient of restitution of the body, typically between 0 and 1. 0 means no bounciness or elasticity. 1 means full bouncy or elastic.
|
|
539
|
+
* @default the restitution value set in the world options (which itself defaults to 0.5)
|
|
540
|
+
*/
|
|
541
|
+
restitution: number;
|
|
542
|
+
/** Whether to use the minimum, maximum or average (default) value for restitution between the two bodies involved in a collision
|
|
543
|
+
* @default CoefficientFunctionType.average
|
|
544
|
+
*/
|
|
545
|
+
restitutionFunction: PropertyDefinition_2<CoefficientFunctionType, true>;
|
|
546
|
+
/** Whether the body is currently sleeping (this is automatically managed) */
|
|
547
|
+
isSleeping: PropertyDefinitionBoolean<true>;
|
|
548
|
+
/** Scale factor for gravity applied to the body. Set to 0 to disable gravity on this body. */
|
|
549
|
+
gravityScale: number;
|
|
550
|
+
/** Density of the body in kilograms per cubic meter. If unspecified, density will be derived from the body's mass and its shape's volume */
|
|
551
|
+
density: number;
|
|
552
|
+
/** Mass of the body in kilograms. Mass is automatically derived from the body's density and its shape's volume, unless the density is set to 0, in which case, the density is derived from the mass. */
|
|
553
|
+
mass: number;
|
|
554
|
+
/** Collision groups the body belongs to
|
|
555
|
+
* @default AllFlag, which means the body belongs to all groups
|
|
556
|
+
*/
|
|
557
|
+
belongsToGroups: PropertyDefinitionNumber<true>;
|
|
558
|
+
/** Collision groups the body can collide with
|
|
559
|
+
* @default AllFlag, which means the body can collide with all groups
|
|
560
|
+
*/
|
|
561
|
+
collidesWithGroups: PropertyDefinitionNumber<true>;
|
|
562
|
+
/** Whether the body is allowed to sleep
|
|
563
|
+
* @default true
|
|
564
|
+
*/
|
|
565
|
+
isSleepingEnabled: PropertyDefinitionBoolean<true>;
|
|
566
|
+
/** Linear damping applied to the body. Set to a negative value to use the world's default linear damping
|
|
567
|
+
* @default -1, which means to use the world's default linear damping
|
|
568
|
+
*/
|
|
569
|
+
linearDamping: number;
|
|
570
|
+
/** Angular damping applied to the body. Set to a negative value to use the world's default angular damping.
|
|
571
|
+
* @default -1, which means to use the world's default angular damping
|
|
572
|
+
*/
|
|
573
|
+
angularDamping: number;
|
|
574
|
+
/** Mainly for internal use. Time the body has been without moving, automatically maintained and used for sleep detection */
|
|
575
|
+
timeWithoutMoving: PropertyDefinitionNumber<true>;
|
|
576
|
+
/** Mainly for internal use. Computed center of mass position in world space. This is automatically updated when the body's shape, position or orientation changes (after commitChanged is called) */
|
|
425
577
|
computedCenterOfMassPosition: PropertyDefinition_2<NoInfer<number[] | {
|
|
426
578
|
x?: number;
|
|
427
579
|
y?: number;
|
|
428
580
|
z?: number;
|
|
429
581
|
} | undefined>, true, typeof Vec3>;
|
|
582
|
+
/** Mainly for internal use. Computed axis-aligned bounding box of the body in world space. This is automatically updated when the body's shape, position or orientation changes (after commitChanged is called) */
|
|
430
583
|
computedBounds: PropertyDefinition_2<NoInfer<PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap<{
|
|
431
584
|
min: typeof Vec3;
|
|
432
585
|
max: typeof Vec3;
|
|
@@ -436,6 +589,7 @@ y?: number;
|
|
|
436
589
|
z?: number;
|
|
437
590
|
} | undefined>, true, typeof Vec3>;
|
|
438
591
|
}>> | undefined>, true, typeof Aabb>;
|
|
592
|
+
/** Mainly for internal use. Computed expanded axis-aligned bounding box of the body in world space. This is automatically updated when the body's shape, position or orientation changes (after commitChanged is called) */
|
|
439
593
|
computedExpandedBounds: PropertyDefinition_2<NoInfer<PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap<{
|
|
440
594
|
min: typeof Vec3;
|
|
441
595
|
max: typeof Vec3;
|
|
@@ -445,21 +599,31 @@ y?: number;
|
|
|
445
599
|
z?: number;
|
|
446
600
|
} | undefined>, true, typeof Vec3>;
|
|
447
601
|
}>> | undefined>, true, typeof Aabb>;
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
602
|
+
/** Mainly for internal use. */
|
|
603
|
+
/** Mainly for internal use. */
|
|
604
|
+
/** Mainly for internal use. This is the type of the current shape, e.g. sphere, box, etc */
|
|
605
|
+
shapeType: PropertyDefinition_2<ShapeType, true>;
|
|
606
|
+
/** Mainly for internal use. References to the specific shape instances based on the shape type */
|
|
607
|
+
shape0: PropertyDefinitionReference<Box | null, true>;
|
|
608
|
+
/** Mainly for internal use. References to the specific shape instances based on the shape type */
|
|
609
|
+
shape1: PropertyDefinitionReference<Capsule | null, true>;
|
|
610
|
+
/** Mainly for internal use. References to the specific shape instances based on the shape type */
|
|
611
|
+
shape2: PropertyDefinitionReference<CompoundShape | null, true>;
|
|
612
|
+
/** Mainly for internal use. References to the specific shape instances based on the shape type */
|
|
613
|
+
shape3: PropertyDefinitionReference<ConvexHull | null, true>;
|
|
614
|
+
/** Mainly for internal use. References to the specific shape instances based on the shape type */
|
|
615
|
+
shape4: PropertyDefinitionReference<Cylinder | null, true>;
|
|
616
|
+
/** Mainly for internal use. References to the specific shape instances based on the shape type */
|
|
617
|
+
shape5: PropertyDefinitionReference<HeightMap | null, true>;
|
|
618
|
+
/** Mainly for internal use. References to the specific shape instances based on the shape type */
|
|
619
|
+
shape6: PropertyDefinitionReference<Sphere | null, true>;
|
|
620
|
+
/** Mainly for internal use. References to the specific shape instances based on the shape type */
|
|
621
|
+
shape7: PropertyDefinitionReference<TriangleMesh | null, true>;
|
|
622
|
+
/** Mainly for internal use. Used for tracking sleep islands */
|
|
623
|
+
sleepVisitGeneration: PropertyDefinitionNumber<true>;
|
|
624
|
+
/** Mainly for internal use. Inverse mass of the body in kilograms. This is automatically derived from the body's mass. */
|
|
462
625
|
inverseMass: PropertyDefinitionNumber<true>;
|
|
626
|
+
/** Mainly for internal use. Computed local inverse inertia tensor of the body. This is automatically updated when the body's shape changes (after commitChanged is called) */
|
|
463
627
|
computedLocalInverseInertia: PropertyDefinition_2<NoInfer<PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap<{
|
|
464
628
|
e0: number;
|
|
465
629
|
e1: number;
|
|
@@ -471,6 +635,7 @@ e6: number;
|
|
|
471
635
|
e7: number;
|
|
472
636
|
e8: number;
|
|
473
637
|
}>> | undefined>, true, typeof Mat3>;
|
|
638
|
+
/** Mainly for internal use. Computed world inverse inertia tensor of the body. This is automatically updated when the body's shape, position or orientation changes (after commitChanged is called) */
|
|
474
639
|
computedWorldInverseInertia: PropertyDefinition_2<NoInfer<PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap<{
|
|
475
640
|
e0: number;
|
|
476
641
|
e1: number;
|
|
@@ -482,37 +647,24 @@ e6: number;
|
|
|
482
647
|
e7: number;
|
|
483
648
|
e8: number;
|
|
484
649
|
}>> | undefined>, true, typeof Mat3>;
|
|
485
|
-
|
|
486
|
-
gravityScale: number;
|
|
650
|
+
/** Mainly for internal use. Accumulated linear forces applied to the body. Typically you would use applyForce or applyImpulse instead of directly modifying this property. */
|
|
487
651
|
linearForces: PropertyDefinition_2<NoInfer<number[] | {
|
|
488
652
|
x?: number;
|
|
489
653
|
y?: number;
|
|
490
654
|
z?: number;
|
|
491
655
|
} | undefined>, true, typeof Vec3>;
|
|
656
|
+
/** Mainly for internal use. Accumulated angular forces applied to the body.Typically you would use applyForce or applyImpulse instead of directly modifying this property. */
|
|
492
657
|
angularForces: PropertyDefinition_2<NoInfer<number[] | {
|
|
493
658
|
x?: number;
|
|
494
659
|
y?: number;
|
|
495
660
|
z?: number;
|
|
496
661
|
} | undefined>, true, typeof Vec3>;
|
|
662
|
+
/** Mainly for internal use. Copy of the body used to check what has changed when commiting changes. */
|
|
497
663
|
copyForDiff: PropertyDefinitionReference<NoInfer<Body_2> | null, true>;
|
|
664
|
+
/** Mainly for internal use. A linked list of contact pair references for the body, to allow us to quickly destroy them when the body is destroyed. */
|
|
498
665
|
firstPotentialPairEdge: PropertyDefinitionReference<NoInfer<BodyPairEdge> | null, true>;
|
|
499
|
-
|
|
500
|
-
collidesWithGroups: PropertyDefinitionNumber<true>;
|
|
501
|
-
node: PropertyDefinitionReference<NoInfer<BvhNode> | null, true>;
|
|
502
|
-
shapeType: PropertyDefinition_2<ShapeType, true>;
|
|
503
|
-
shape0: PropertyDefinitionReference<Box | null, true>;
|
|
504
|
-
shape1: PropertyDefinitionReference<Capsule | null, true>;
|
|
505
|
-
shape2: PropertyDefinitionReference<CompoundShape | null, true>;
|
|
506
|
-
shape3: PropertyDefinitionReference<ConvexHull | null, true>;
|
|
507
|
-
shape4: PropertyDefinitionReference<Cylinder | null, true>;
|
|
508
|
-
shape5: PropertyDefinitionReference<HeightMap | null, true>;
|
|
509
|
-
shape6: PropertyDefinitionReference<Sphere | null, true>;
|
|
510
|
-
shape7: PropertyDefinitionReference<TriangleMesh | null, true>;
|
|
511
|
-
isSleepingEnabled: PropertyDefinitionBoolean<true>;
|
|
512
|
-
linearDamping: number;
|
|
513
|
-
angularDamping: number;
|
|
666
|
+
/** Mainly for internal use. A linked list of constraint pair references for the body, to allow us to quickly destroy them when the body is destroyed. */
|
|
514
667
|
firstPotentialConstraintPairEdge: PropertyDefinitionReference<NoInfer<ConstraintPairEdge> | null, true>;
|
|
515
|
-
visitGeneration: PropertyDefinitionNumber<true>;
|
|
516
668
|
}>> & {
|
|
517
669
|
shape: Shape;
|
|
518
670
|
world?: World | null;
|
|
@@ -597,16 +749,6 @@ export declare const enum BodyType {
|
|
|
597
749
|
static = 2
|
|
598
750
|
}
|
|
599
751
|
|
|
600
|
-
declare interface BodyVisitor {
|
|
601
|
-
shouldExit: boolean;
|
|
602
|
-
visit(body: Body_2): void;
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
declare interface BodyVisitor_2 {
|
|
606
|
-
shouldExit: boolean;
|
|
607
|
-
visit(body: Body_2): void;
|
|
608
|
-
}
|
|
609
|
-
|
|
610
752
|
export declare class Box extends Box_base implements ConvexShapeInterface {
|
|
611
753
|
type: ShapeType.box;
|
|
612
754
|
world: World | null;
|
|
@@ -732,6 +874,7 @@ declare interface BuildTriangleMeshParams {
|
|
|
732
874
|
declare class BvhModule {
|
|
733
875
|
_intersectTargetBody: Body_2 | null;
|
|
734
876
|
_createPairCallback(bodyB: Body_2): boolean;
|
|
877
|
+
bvhNodePool: PoolClass<BvhNode>;
|
|
735
878
|
world: World;
|
|
736
879
|
options: BvhModuleOptions;
|
|
737
880
|
dynamicTree: BvhTree;
|
|
@@ -739,8 +882,10 @@ declare class BvhModule {
|
|
|
739
882
|
pairs: BodyPairsModule;
|
|
740
883
|
bodiesThatDidRefit: Set<Body_2>;
|
|
741
884
|
constructor(world: World, options?: Partial<BvhModuleOptions>);
|
|
885
|
+
removeBody(body: WithPool<Body_2>): void;
|
|
742
886
|
toArray(array: NumberArray, startOffset: number): number;
|
|
743
887
|
fromArray(array: NumberArray, startOffset: number): number;
|
|
888
|
+
markStaticBodyAsDirty(body: WithPool<Body_2>): void;
|
|
744
889
|
markDynamicBodyAsDirty(body: WithPool<Body_2>): void;
|
|
745
890
|
updateDirtyBodies(): void;
|
|
746
891
|
addDynamicBody(body: WithPool<Body_2>): void;
|
|
@@ -750,9 +895,9 @@ declare class BvhModule {
|
|
|
750
895
|
removeKinematicBody(body: WithPool<Body_2>): void;
|
|
751
896
|
removeStaticBody(body: WithPool<Body_2>): void;
|
|
752
897
|
iteratePairs(): Generator<BodyPairNode, void, unknown>;
|
|
753
|
-
visitBodiesWithCollision(
|
|
754
|
-
visitBodiesWithCast(
|
|
755
|
-
raycastBodies(
|
|
898
|
+
visitBodiesWithCollision(visitCallback: VisitBodyCallback, aabb: Aabb, belongsToGroups: number, collidesWithGroups: number): void;
|
|
899
|
+
visitBodiesWithCast(visitCallback: VisitBodyCallback, aabb: Aabb, displacement: Vec3, belongsToGroups: number, collidesWithGroups: number): void;
|
|
900
|
+
raycastBodies(visitCallback: VisitBodyCallback, ray: Ray, belongsToGroups: number, collidesWithGroups: number): void;
|
|
756
901
|
}
|
|
757
902
|
|
|
758
903
|
declare interface BvhModuleOptions {
|
|
@@ -799,7 +944,8 @@ objects: PropertyDefinitionReferenceList<Body_2, ReferenceListInputType<typeof B
|
|
|
799
944
|
|
|
800
945
|
export declare class BvhTree {
|
|
801
946
|
options: BvhTreeOptions;
|
|
802
|
-
|
|
947
|
+
bvhTreeNodes: typeof BvhNode.ReferenceList;
|
|
948
|
+
bodyToBvhNodeMap: typeof BvhNode.ReferenceList;
|
|
803
949
|
bodyPool: typeof Body_2.Pool;
|
|
804
950
|
root: BvhNode | null;
|
|
805
951
|
optimizeQueue: BvhNode[];
|
|
@@ -813,6 +959,8 @@ export declare class BvhTree {
|
|
|
813
959
|
rebalance(node: BvhNode): BvhNode;
|
|
814
960
|
refit(node: BvhNode | null): boolean;
|
|
815
961
|
optimizeOncePerFrame(maxNodesToCheck: number): void;
|
|
962
|
+
getBodyNode(body: Body_2): WithPool<BvhNode> | null;
|
|
963
|
+
setBodyNode(body: Body_2 | WithPool<Body_2>, node: BvhNode | WithPool<BvhNode> | null): void;
|
|
816
964
|
splitObjects(outLeft: BvhNode, outRight: BvhNode, nodeToSplit: BvhNode): void;
|
|
817
965
|
createBvhNode(): MonomorphInstanceWithPool<ConvertedInputPropertyDefinitionMap< {
|
|
818
966
|
parent: PropertyDefinitionReference<NoInfer<BvhNode> | null, true>;
|
|
@@ -846,16 +994,16 @@ export declare class BvhTree {
|
|
|
846
994
|
objects: PropertyDefinitionReferenceList<Body_2, ReferenceListInputType<typeof Body_2>>;
|
|
847
995
|
}>> | undefined, BvhNode>;
|
|
848
996
|
destroyBvhNode(node: WithPool<BvhNode>): void;
|
|
849
|
-
insert(
|
|
850
|
-
remove(
|
|
997
|
+
insert(bodyToInsert: WithPool<Body_2>): boolean;
|
|
998
|
+
remove(bodyToRemove: WithPool<Body_2>, shouldRemoveFromDirtyObjects?: boolean): boolean | undefined;
|
|
851
999
|
update(object: WithPool<Body_2>, shouldUpdateDirtyObjects?: boolean): boolean;
|
|
852
1000
|
intersectBody(onHit: (Body: Body_2) => boolean | undefined, bodyToIntersect: Body_2, shouldUpdateDirtyObjects?: boolean): void;
|
|
853
1001
|
intersectAabb(onHit: (Body: Body_2) => boolean, bounds: Aabb, shouldUpdateDirtyObjects?: boolean): void;
|
|
854
1002
|
walk(onNode: (node: BvhNode) => boolean): void;
|
|
855
1003
|
isEmpty(): boolean;
|
|
856
|
-
visitBodiesWithCollision(
|
|
857
|
-
raycastBodies(
|
|
858
|
-
visitBodiesWithCast(
|
|
1004
|
+
visitBodiesWithCollision(visitCallback: VisitBodyCallback, bounds: Aabb, belongsToGroups: number, collidesWithGroups: number, shouldUpdateDirtyObjects?: boolean): void;
|
|
1005
|
+
raycastBodies(visitCallback: VisitBodyCallback, ray: Ray, belongsToGroups: number, collidesWithGroups: number, shouldUpdateDirtyObjects?: boolean): void;
|
|
1006
|
+
visitBodiesWithCast(visitCallback: VisitBodyCallback, bounds: Aabb, displacement: Vec3, belongsToGroups: number, collidesWithGroups: number, shouldUpdateDirtyObjects?: boolean): void;
|
|
859
1007
|
}
|
|
860
1008
|
|
|
861
1009
|
export declare type BvhTreeOptions = {
|
|
@@ -968,7 +1116,6 @@ radius: number;
|
|
|
968
1116
|
|
|
969
1117
|
export declare class CastCollector {
|
|
970
1118
|
static initialEarlyOutFraction: number;
|
|
971
|
-
static shouldEarlyOutFraction: number;
|
|
972
1119
|
earlyOutFraction: number;
|
|
973
1120
|
body2: Body_2 | null;
|
|
974
1121
|
getEarlyOutFraction(): number;
|
|
@@ -979,11 +1126,6 @@ export declare class CastCollector {
|
|
|
979
1126
|
addMiss(): void;
|
|
980
1127
|
}
|
|
981
1128
|
|
|
982
|
-
export declare interface CastRayResult {
|
|
983
|
-
body: Body_2;
|
|
984
|
-
fraction: number;
|
|
985
|
-
}
|
|
986
|
-
|
|
987
1129
|
export declare class CastResult extends CastResult_base {
|
|
988
1130
|
/**
|
|
989
1131
|
* swaps the A and B data
|
|
@@ -1098,7 +1240,8 @@ declare class CollideBodiesModule {
|
|
|
1098
1240
|
collideBodies(bodyA: Body_2, bodyB: Body_2, collideShapesSettings: CollisionSettings, collideBodiesSettings: CollideBodiesSettings, timeStepSizeSeconds: number, isWarmStartingEnabled: boolean, minVelocityForElasticContact: number): void;
|
|
1099
1241
|
collideShape(inShape: Shape, inShapeScale: number, inCenterOfMassTransform: Isometry, ioCollector: CollisionCollector, inCollideShapeSettings: CollisionSettings, inbaseTranslation?: Vec3, mask?: number): void;
|
|
1100
1242
|
castShape(inShape: Shape, inShapeScale: number, inCenterOfMassTransform: Isometry, inDisplacement: Vec3, inShapeCastSettings: CastSettings, inbaseTranslation: Vec3, ioCollector: CastCollector, mask?: number): void;
|
|
1101
|
-
|
|
1243
|
+
castRayApproximate(onHit: (body: Body_2) => boolean | undefined, ray: Ray, belongsToGroups?: number, collidesWithGroups?: number): void;
|
|
1244
|
+
castRay(onHit: (result: CastResult) => boolean | undefined, ray: Ray, returnClosestOnly?: boolean, belongsToGroups?: number, collidesWithGroups?: number): void;
|
|
1102
1245
|
estimateCollisionResponse(result: EstimateCollisionResponseResult, bodyA: Body_2, bodyB: Body_2, timeStepSizeSeconds: number): void;
|
|
1103
1246
|
}
|
|
1104
1247
|
|
|
@@ -1107,10 +1250,7 @@ declare interface CollideBodiesSettings {
|
|
|
1107
1250
|
}
|
|
1108
1251
|
|
|
1109
1252
|
export declare const enum ColliderType {
|
|
1110
|
-
|
|
1111
|
-
findContactManifoldOnly = 1,
|
|
1112
|
-
resolveContact = 2,
|
|
1113
|
-
attractor = 3
|
|
1253
|
+
resolveContact = 0
|
|
1114
1254
|
}
|
|
1115
1255
|
|
|
1116
1256
|
export declare class CollideShapesModule {
|
|
@@ -1121,7 +1261,6 @@ export declare class CollideShapesModule {
|
|
|
1121
1261
|
|
|
1122
1262
|
export declare class CollisionCollector {
|
|
1123
1263
|
static initialEarlyOutFraction: number;
|
|
1124
|
-
static shouldEarlyOutFraction: number;
|
|
1125
1264
|
earlyOutFraction: number;
|
|
1126
1265
|
body2: Body_2 | null;
|
|
1127
1266
|
getEarlyOutFraction(): number;
|
|
@@ -1131,22 +1270,6 @@ export declare class CollisionCollector {
|
|
|
1131
1270
|
addMiss(): void;
|
|
1132
1271
|
}
|
|
1133
1272
|
|
|
1134
|
-
export declare namespace CollisionFilter {
|
|
1135
|
-
export {
|
|
1136
|
-
createBitFlags,
|
|
1137
|
-
shouldPairCollide,
|
|
1138
|
-
shouldCollide,
|
|
1139
|
-
addFlag,
|
|
1140
|
-
removeFlag,
|
|
1141
|
-
toggleFlag,
|
|
1142
|
-
hasFlag,
|
|
1143
|
-
doesNotHaveFlag,
|
|
1144
|
-
setFlags,
|
|
1145
|
-
NoneFlag,
|
|
1146
|
-
AllFlag
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
1273
|
export declare class CollisionResult extends CollisionResult_base {
|
|
1151
1274
|
/**
|
|
1152
1275
|
* swaps the A and B data
|
|
@@ -1195,6 +1318,9 @@ faceB: typeof Face;
|
|
|
1195
1318
|
}>> | undefined>;
|
|
1196
1319
|
|
|
1197
1320
|
export declare interface CollisionSettings {
|
|
1321
|
+
/** maximum separation in meters between shapes that will generate collision information. increasing this can improve performance of fast-moving objects at the cost of accuracy and can cause jitter when resting on surfaces. decreasing it can improve accuracy and reduce jitter but may cause fast-moving objects to tunnel through thin geometry or miss collisions, especially if the `speculativeContactDistance` is also small.
|
|
1322
|
+
* @default 0.02
|
|
1323
|
+
*/
|
|
1198
1324
|
maxSeparation: number;
|
|
1199
1325
|
collisionTolerance: number;
|
|
1200
1326
|
activeEdgeMode: ActiveEdgeMode;
|
|
@@ -1780,11 +1906,11 @@ declare interface Copyable<T> {
|
|
|
1780
1906
|
copy(value: T): void;
|
|
1781
1907
|
}
|
|
1782
1908
|
|
|
1783
|
-
declare function createBitFlags<T extends readonly string[]>(keys: T): {
|
|
1909
|
+
export declare function createBitFlags<T extends readonly string[]>(keys: T): {
|
|
1784
1910
|
[K in T[number] | "None" | "All"]: number;
|
|
1785
1911
|
};
|
|
1786
1912
|
|
|
1787
|
-
declare class Cylinder extends Cylinder_base implements ConvexShapeInterface {
|
|
1913
|
+
export declare class Cylinder extends Cylinder_base implements ConvexShapeInterface {
|
|
1788
1914
|
type: ShapeType.cylinder;
|
|
1789
1915
|
world: World | null;
|
|
1790
1916
|
intersectsAabb(aabb: Aabb): boolean;
|
|
@@ -2028,9 +2154,7 @@ referenceFrame: PropertyDefinition_2<ReferenceFrame, true>;
|
|
|
2028
2154
|
isEnabled: PropertyDefinitionBoolean<true>;
|
|
2029
2155
|
}>> | undefined>;
|
|
2030
2156
|
|
|
2031
|
-
declare
|
|
2032
|
-
|
|
2033
|
-
declare type DynamicShape = Exclude<Shape, HeightMap>;
|
|
2157
|
+
export declare type DynamicShape = Exclude<Shape, HeightMap>;
|
|
2034
2158
|
|
|
2035
2159
|
declare class Edge extends Edge_base {
|
|
2036
2160
|
}
|
|
@@ -2365,9 +2489,7 @@ declare interface GjkModuleSettings {
|
|
|
2365
2489
|
tolerance: number;
|
|
2366
2490
|
}
|
|
2367
2491
|
|
|
2368
|
-
declare
|
|
2369
|
-
|
|
2370
|
-
declare class HeightMap extends HeightMap_base implements ShapeCollectionInterface {
|
|
2492
|
+
export declare class HeightMap extends HeightMap_base implements ShapeCollectionInterface {
|
|
2371
2493
|
type: ShapeType.heightMap;
|
|
2372
2494
|
world: World | null;
|
|
2373
2495
|
heights: number[];
|
|
@@ -2813,7 +2935,7 @@ matrix: typeof Mat4;
|
|
|
2813
2935
|
matrix: typeof Mat4;
|
|
2814
2936
|
}>> | undefined>;
|
|
2815
2937
|
|
|
2816
|
-
declare type KinematicShape = Exclude<Shape, HeightMap>;
|
|
2938
|
+
export declare type KinematicShape = Exclude<Shape, HeightMap>;
|
|
2817
2939
|
|
|
2818
2940
|
export declare class Line extends Line_base {
|
|
2819
2941
|
setFromPointAndDirection(point: Vec3, direction: Vec3, length: number): void;
|
|
@@ -3416,18 +3538,11 @@ direction: typeof Vec3;
|
|
|
3416
3538
|
length: number;
|
|
3417
3539
|
}>> | undefined>;
|
|
3418
3540
|
|
|
3419
|
-
declare interface RayCastSettings {
|
|
3420
|
-
precision?: QueryPrecision;
|
|
3421
|
-
returnClosestOnly?: boolean;
|
|
3422
|
-
}
|
|
3423
|
-
|
|
3424
3541
|
export declare const enum ReferenceFrame {
|
|
3425
3542
|
local = 0,
|
|
3426
3543
|
world = 1
|
|
3427
3544
|
}
|
|
3428
3545
|
|
|
3429
|
-
declare function removeFlag(flag: number, value: number): number;
|
|
3430
|
-
|
|
3431
3546
|
declare class RotationEulerComponent extends RotationEulerComponent_base {
|
|
3432
3547
|
world: World;
|
|
3433
3548
|
deactivate(): void;
|
|
@@ -3547,8 +3662,6 @@ pointA: typeof Vec3;
|
|
|
3547
3662
|
pointB: typeof Vec3;
|
|
3548
3663
|
}>> | undefined>;
|
|
3549
3664
|
|
|
3550
|
-
declare function setFlags(...values: number[]): number;
|
|
3551
|
-
|
|
3552
3665
|
export declare type Shape = ConvexShape | ShapeCollection;
|
|
3553
3666
|
|
|
3554
3667
|
declare interface ShapeCastSettings {
|
|
@@ -3588,10 +3701,6 @@ export declare const enum ShapeType {
|
|
|
3588
3701
|
triangleMesh = 7
|
|
3589
3702
|
}
|
|
3590
3703
|
|
|
3591
|
-
declare function shouldCollide(maskA: number, groupB: number): boolean;
|
|
3592
|
-
|
|
3593
|
-
declare function shouldPairCollide(groupA: number, maskA: number, groupB: number, maskB: number): boolean;
|
|
3594
|
-
|
|
3595
3704
|
declare class SleepModule {
|
|
3596
3705
|
options: SleepOptions;
|
|
3597
3706
|
contactPairs: BodyPairsModule;
|
|
@@ -3785,7 +3894,7 @@ declare class StaticArray<T extends Copyable<any>> {
|
|
|
3785
3894
|
[Symbol.iterator](): Iterator<T>;
|
|
3786
3895
|
}
|
|
3787
3896
|
|
|
3788
|
-
declare type StaticShape = Shape;
|
|
3897
|
+
export declare type StaticShape = Shape;
|
|
3789
3898
|
|
|
3790
3899
|
export declare const enum SupportMode {
|
|
3791
3900
|
ExcludeConvexRadius = 0,
|
|
@@ -3810,8 +3919,6 @@ declare interface SupportShapeWithConvexRadius extends SupportShape {
|
|
|
3810
3919
|
getConvexRadius(): number;
|
|
3811
3920
|
}
|
|
3812
3921
|
|
|
3813
|
-
declare function toggleFlag(flag: number, value: number): number;
|
|
3814
|
-
|
|
3815
3922
|
export declare class TransformedShape extends TransformedShape_base {
|
|
3816
3923
|
get shape(): Shape | null;
|
|
3817
3924
|
set shape(value: Shape);
|
|
@@ -4257,6 +4364,8 @@ declare type Vec3Input = {
|
|
|
4257
4364
|
z?: number;
|
|
4258
4365
|
} | number[] | undefined;
|
|
4259
4366
|
|
|
4367
|
+
declare type VisitBodyCallback = (body: Body_2) => boolean | undefined | void;
|
|
4368
|
+
|
|
4260
4369
|
/**
|
|
4261
4370
|
* a container and API for a physics simulation
|
|
4262
4371
|
*/
|
|
@@ -4274,9 +4383,6 @@ export declare class World {
|
|
|
4274
4383
|
convexHullBuilder: ConvexHullBuilder;
|
|
4275
4384
|
triangleMeshBuilder: TriangleMeshBuilder;
|
|
4276
4385
|
constraintSolver: ConstraintSolver;
|
|
4277
|
-
dynamicBodyCopies: typeof Body_2.ReferenceList;
|
|
4278
|
-
kinematicBodyCopies: typeof Body_2.ReferenceList;
|
|
4279
|
-
staticBodyCopies: typeof Body_2.ReferenceList;
|
|
4280
4386
|
dynamicBodies: typeof Body_2.ReferenceList;
|
|
4281
4387
|
kinematicBodies: typeof Body_2.ReferenceList;
|
|
4282
4388
|
staticBodies: typeof Body_2.ReferenceList;
|
|
@@ -4308,7 +4414,6 @@ export declare class World {
|
|
|
4308
4414
|
triangleMeshCopy: typeof TriangleMesh.Pool;
|
|
4309
4415
|
compoundShapeCopy: typeof CompoundShape.Pool;
|
|
4310
4416
|
heightMapCopy: typeof HeightMap.Pool;
|
|
4311
|
-
bvhNodes: typeof BvhNode.Pool;
|
|
4312
4417
|
constraintPairNode: typeof ConstraintPairNode.Pool;
|
|
4313
4418
|
constraintPairEdge: typeof ConstraintPairEdge.Pool;
|
|
4314
4419
|
body: typeof Body_2.Pool;
|
|
@@ -4325,7 +4430,6 @@ export declare class World {
|
|
|
4325
4430
|
constructor(options?: PartialRecursive<WorldOptions>);
|
|
4326
4431
|
collideBodiesWithBroadphase(timeStepSizeSeconds: number, isWarmStartingEnabled: boolean, minVelocityForElasticContact: number): void;
|
|
4327
4432
|
iterateOverBodyPairsBruteForce(): Generator<NoInfer<[WithPool<Body_2>, WithPool<Body_2>]>, void, unknown>;
|
|
4328
|
-
collideBodiesWithoutBroadphase(timeStepSizeSeconds: number, isWarmStartingEnabled: boolean, minVelocityForElasticContact: number): void;
|
|
4329
4433
|
/**
|
|
4330
4434
|
* integrates the acceleration of all bodies
|
|
4331
4435
|
*/
|
|
@@ -4386,7 +4490,8 @@ export declare class World {
|
|
|
4386
4490
|
didBodiesCollide(bodyA: Body_2, bodyB: Body_2): boolean;
|
|
4387
4491
|
iterateContactManifolds(bodyA?: Body_2, bodyB?: Body_2): Generator<ContactManifold, void, unknown>;
|
|
4388
4492
|
intersectShape(onHit: (result: CollisionResult) => boolean | undefined, shape: Shape, transform: BasicTransform | InputType<BasicTransform>, settings?: ShapeIntersectSettings): void;
|
|
4389
|
-
|
|
4493
|
+
castRayApproximate(onHit: (body: Body_2) => boolean | undefined, ray: Ray, belongsToGroups?: number, collidesWithGroups?: number): void;
|
|
4494
|
+
castRay(onHit: (result: CastResult) => boolean | undefined, ray: Ray, returnClosestOnly?: boolean, belongsToGroups?: number, collidesWithGroups?: number): void;
|
|
4390
4495
|
castShape(onHit: (result: CastShapeResult) => boolean, shape: Shape, transform: BasicTransform, displacementOrEndPosition: Vec3, settings?: ShapeCastSettings): void;
|
|
4391
4496
|
estimateCollisionResponse(result: EstimateCollisionResponseResult, bodyA: Body_2, bodyB: Body_2, settings?: Partial<EstimateCollisionResponseSettings>): void;
|
|
4392
4497
|
toArray(array: number[] | Float32Array | Float64Array, startOffset?: number): number;
|
|
@@ -4399,31 +4504,95 @@ export declare class World {
|
|
|
4399
4504
|
}
|
|
4400
4505
|
|
|
4401
4506
|
declare interface WorldOptions {
|
|
4507
|
+
/** gravity in m/s^2
|
|
4508
|
+
* @default earth gravity ([0, -9.80665, 0])
|
|
4509
|
+
*/
|
|
4402
4510
|
gravity: InputType<Vec3>;
|
|
4403
|
-
|
|
4511
|
+
/** enables/disables gravity on the whole world
|
|
4512
|
+
* @default true
|
|
4513
|
+
*/
|
|
4404
4514
|
isGravityEnabled: boolean;
|
|
4515
|
+
/** default restitution (how elastic/bouncy collisions will be) for created/reset bodies, if unspecified on the body.
|
|
4516
|
+
* @default 0.2
|
|
4517
|
+
*/
|
|
4405
4518
|
restitution: number;
|
|
4519
|
+
/** default friction for created/reset bodies, if unspecified on the body
|
|
4520
|
+
* @default 0.5
|
|
4521
|
+
*/
|
|
4406
4522
|
friction: number;
|
|
4523
|
+
/** the number of iterations to solve velocity constraints. lower is more performant, higher has better results, especially for stacks or conflicting constraints.
|
|
4524
|
+
* @default 6
|
|
4525
|
+
*/
|
|
4407
4526
|
solveVelocityIterations: number;
|
|
4527
|
+
/** the number of iterations to solve position constraints. lower is more performant, higher has better results, especially for stacks or conflicting constraints.
|
|
4528
|
+
* @default 2
|
|
4529
|
+
*/
|
|
4408
4530
|
solvePositionIterations: number;
|
|
4531
|
+
/** default linear damping for created/reset bodies, if unspecified on the body
|
|
4532
|
+
* @default 0.05
|
|
4533
|
+
* @note this is not applied as a constant factor each step, but rather integrated as part of the velocity integration, so it should be stable across different time step sizes
|
|
4534
|
+
*/
|
|
4409
4535
|
linearDamping: number;
|
|
4536
|
+
/** default angular damping for created/reset bodies, if unspecified on the body
|
|
4537
|
+
* @default 0.05
|
|
4538
|
+
* @note this is not applied as a constant factor each step, but rather integrated as part of the velocity integration, so it should be stable across different time step sizes
|
|
4539
|
+
*/
|
|
4410
4540
|
angularDamping: number;
|
|
4541
|
+
/** default friction function for created/reset bodies, if unspecified on the body
|
|
4542
|
+
* @default CoefficientFunctionType.max
|
|
4543
|
+
*/
|
|
4411
4544
|
frictionFunction: CoefficientFunctionType;
|
|
4545
|
+
/** default restitution function for created/reset bodies, if unspecified on the body
|
|
4546
|
+
* @default CoefficientFunctionType.max
|
|
4547
|
+
*/
|
|
4412
4548
|
restitutionFunction: CoefficientFunctionType;
|
|
4549
|
+
/** minimum velocity in m/s for a contact to be treated as elastic instead of inelastic. this is used to prevent jittery resting contacts, while still allowing for elastic collisions at higher speeds. tuning this can help with the stability of stacks and resting contacts. if you are seeing jittery behavior in resting contacts, try increasing this value. if you are seeing objects that should be bouncing not bounce, try decreasing this value.
|
|
4550
|
+
* @default 2
|
|
4551
|
+
*/
|
|
4413
4552
|
minVelocityForElasticContact: number;
|
|
4553
|
+
/** the baumgarte factor to use for position correction. higher values will correct positions faster, but can lead to instability if too high. lower values will be more stable, but can lead to more noticeable sinking and jitter. tuning this can help with the stability of stacks and resting contacts. if you are seeing sinking or noticeable jitter in resting contacts, try increasing this value. if you are seeing instability, try decreasing this value.
|
|
4554
|
+
* @default 0.2
|
|
4555
|
+
*/
|
|
4414
4556
|
baumgarte: number;
|
|
4557
|
+
/** the penetration slop in meters. this is the distance that contact points can penetrate before the solver starts to apply correction. having a small penetration slop can help with the stability of stacks and resting contacts, but can lead to more noticeable jitter. tuning this can help with the stability of stacks and resting contacts. if you are seeing sinking or noticeable jitter in resting contacts, try increasing this value. if you are seeing instability, try decreasing this value.
|
|
4558
|
+
* @default 0.02
|
|
4559
|
+
*/
|
|
4415
4560
|
penetrationSlop: number;
|
|
4561
|
+
/** the maximum penetration distance in meters. this is the maximum distance that the solver will apply correction for penetrations in one solver step.
|
|
4562
|
+
* @default 0.2
|
|
4563
|
+
*/
|
|
4416
4564
|
maxPenetrationDistance: number;
|
|
4565
|
+
/** the speculative contact distance in meters. basically this is the minimum distance two bodies need to be apart before they can be considered to be in contact, to reduce the chance of tunneling, or missed collisions from tiny bounces when at rest.
|
|
4566
|
+
* @default 0.02
|
|
4567
|
+
*/
|
|
4417
4568
|
speculativeContactDistance: number;
|
|
4418
|
-
|
|
4569
|
+
/** maximum linear speed in m/s, used to avoid excessively high speeds that can cause instability in the solver and tunneling through collision geometry. applied during acceleration integration and velocity clamping.
|
|
4570
|
+
* @default 30
|
|
4571
|
+
*/
|
|
4419
4572
|
maxLinearSpeed: number;
|
|
4573
|
+
/** maximum angular speed in rad/s, used to avoid excessively high angular speeds that can cause instability in the solver and tunneling through collision geometry. applied during acceleration integration and velocity clamping.
|
|
4574
|
+
* @default 20
|
|
4575
|
+
*/
|
|
4420
4576
|
maxAngularSpeed: number;
|
|
4577
|
+
/** enables warm starting of contact and constraint impulses by reusing cached lambdas between steps. improves stacking stability but can add jitter if contacts change rapidly.
|
|
4578
|
+
* @default true
|
|
4579
|
+
*/
|
|
4421
4580
|
isWarmStartingEnabled: boolean;
|
|
4581
|
+
/** base collision settings for narrowphase shape-vs-shape tests. `maxSeparation` and active-edge movement direction are overwritten per-pair in the collide-bodies pass.
|
|
4582
|
+
* @default { maxSeparation: 0.02, collisionTolerance: 1e-4, activeEdgeMode: ActiveEdgeMode.CollideOnlyWithActive, collectFacesMode: CollectFacesMode.NoFaces, penetrationTolerance: 1e-4, activeEdgeMovementDirectionX: 0, activeEdgeMovementDirectionY: 0, activeEdgeMovementDirectionZ: 0, backFaceMode: BackFaceMode.IgnoreBackFaces }
|
|
4583
|
+
*/
|
|
4422
4584
|
collideShapeSettings: CollisionSettings;
|
|
4585
|
+
/** fixed time step size in seconds used by `takeOneStep`, `advanceTime`, and collision response estimation. Ignored if `takeOneStep` is called with a specific time step size. A smaller time step size can lead to a more stable simulation, but will be more computationally expensive.
|
|
4586
|
+
* @default 1 / 60
|
|
4587
|
+
*/
|
|
4423
4588
|
timeStepSizeSeconds: number;
|
|
4589
|
+
/** maximum real-time delta to simulate in a single `advanceTime` call to prevent spiral-of-death on slow frames.
|
|
4590
|
+
* @default .2
|
|
4591
|
+
*/
|
|
4424
4592
|
maxTimeToSimulateSeconds: number;
|
|
4425
4593
|
sleepOptions?: PartialRecursive<SleepOptions>;
|
|
4426
4594
|
contactManifoldOptions?: PartialRecursive<ManifoldCacheOptions>;
|
|
4595
|
+
broadphaseOptions: PartialRecursive<BvhModuleOptions>;
|
|
4427
4596
|
}
|
|
4428
4597
|
|
|
4429
4598
|
export { }
|