@perplexdotgg/bounce 1.2.5 → 1.3.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/build/bounce.d.ts CHANGED
@@ -272,7 +272,7 @@ readonly scale: 1;
272
272
  declare class Body_2 extends Body_base {
273
273
  world: World | null;
274
274
  get shape(): Shape | null;
275
- set shape(value: Shape);
275
+ set shape(newShape: Shape);
276
276
  /**
277
277
  * integrates the linear velocity of a body
278
278
  */
@@ -318,7 +318,7 @@ declare class Body_2 extends Body_base {
318
318
  }
319
319
  export { Body_2 as Body }
320
320
 
321
- declare const Body_base: Monomorph<Body_2, ConvertedInputPropertyDefinitionMap< {
321
+ declare const Body_base: Monomorph<Body_2, ConvertedInputPropertyDefinitionMap<{
322
322
  readonly type: PropertyDefinition_2<BodyType, true>;
323
323
  readonly position: typeof Vec3;
324
324
  readonly orientation: typeof Quat;
@@ -329,7 +329,7 @@ x?: number;
329
329
  y?: number;
330
330
  z?: number;
331
331
  } | undefined>, true, typeof Vec3>;
332
- readonly computedBounds: PropertyDefinition_2<NoInfer<PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap< {
332
+ readonly computedBounds: PropertyDefinition_2<NoInfer<PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap<{
333
333
  readonly min: typeof Vec3;
334
334
  readonly max: typeof Vec3;
335
335
  readonly centroid: PropertyDefinition_2<NoInfer<number[] | {
@@ -358,7 +358,7 @@ readonly restitutionFunction: PropertyDefinition_2<CoefficientFunctionType, true
358
358
  readonly mass: 0;
359
359
  readonly density: 0;
360
360
  readonly inverseMass: PropertyDefinitionNumber<true>;
361
- readonly computedLocalInverseInertia: PropertyDefinition_2<NoInfer<PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap< {
361
+ readonly computedLocalInverseInertia: PropertyDefinition_2<NoInfer<PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap<{
362
362
  readonly e0: 0;
363
363
  readonly e1: 0;
364
364
  readonly e2: 0;
@@ -369,7 +369,7 @@ readonly e6: 0;
369
369
  readonly e7: 0;
370
370
  readonly e8: 0;
371
371
  }>> | undefined>, true, typeof Mat3>;
372
- readonly computedWorldInverseInertia: PropertyDefinition_2<NoInfer<PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap< {
372
+ readonly computedWorldInverseInertia: PropertyDefinition_2<NoInfer<PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap<{
373
373
  readonly e0: 0;
374
374
  readonly e1: 0;
375
375
  readonly e2: 0;
@@ -411,7 +411,7 @@ readonly linearDamping: -1;
411
411
  readonly angularDamping: -1;
412
412
  readonly firstPotentialConstraintPairEdge: PropertyDefinitionReference<ConstraintPairEdge | null, true>;
413
413
  readonly visitGeneration: PropertyDefinitionNumber<true>;
414
- }>, PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap< {
414
+ }>, PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap<{
415
415
  readonly type: PropertyDefinition_2<BodyType, true>;
416
416
  readonly position: typeof Vec3;
417
417
  readonly orientation: typeof Quat;
@@ -422,7 +422,7 @@ x?: number;
422
422
  y?: number;
423
423
  z?: number;
424
424
  } | undefined>, true, typeof Vec3>;
425
- readonly computedBounds: PropertyDefinition_2<NoInfer<PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap< {
425
+ readonly computedBounds: PropertyDefinition_2<NoInfer<PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap<{
426
426
  readonly min: typeof Vec3;
427
427
  readonly max: typeof Vec3;
428
428
  readonly centroid: PropertyDefinition_2<NoInfer<number[] | {
@@ -451,7 +451,7 @@ readonly restitutionFunction: PropertyDefinition_2<CoefficientFunctionType, true
451
451
  readonly mass: 0;
452
452
  readonly density: 0;
453
453
  readonly inverseMass: PropertyDefinitionNumber<true>;
454
- readonly computedLocalInverseInertia: PropertyDefinition_2<NoInfer<PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap< {
454
+ readonly computedLocalInverseInertia: PropertyDefinition_2<NoInfer<PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap<{
455
455
  readonly e0: 0;
456
456
  readonly e1: 0;
457
457
  readonly e2: 0;
@@ -462,7 +462,7 @@ readonly e6: 0;
462
462
  readonly e7: 0;
463
463
  readonly e8: 0;
464
464
  }>> | undefined>, true, typeof Mat3>;
465
- readonly computedWorldInverseInertia: PropertyDefinition_2<NoInfer<PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap< {
465
+ readonly computedWorldInverseInertia: PropertyDefinition_2<NoInfer<PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap<{
466
466
  readonly e0: 0;
467
467
  readonly e1: 0;
468
468
  readonly e2: 0;
@@ -504,7 +504,9 @@ readonly linearDamping: -1;
504
504
  readonly angularDamping: -1;
505
505
  readonly firstPotentialConstraintPairEdge: PropertyDefinitionReference<ConstraintPairEdge | null, true>;
506
506
  readonly visitGeneration: PropertyDefinitionNumber<true>;
507
- }>> | undefined>;
507
+ }>> & {
508
+ world?: World | null;
509
+ }>;
508
510
 
509
511
  declare class BodyPairEdge extends BodyPairEdge_base {
510
512
  }
@@ -709,12 +711,12 @@ declare interface BuildTriangleMeshParams {
709
711
  vertexPositions: Float32Array;
710
712
  faceIndices: Uint32Array;
711
713
  /**
712
- * If true, skips the creation of a convex hull for the triangle mesh.
713
- * The hull is only used for dynamic bodies, so if the trimesh is only intended
714
- * for static bodies, this can be set to true to save computation time.
715
- * Also this allows for building trimeshes with more than 1k verts (hull limit)
714
+ * If true, forces the creation of a convex hull for the triangle mesh to estimate properties
715
+ * like volume and inertia tensor. The hull is only used for dynamic bodies, so if the trimesh is
716
+ * only intended for static bodies, this can be set to true to save computation time.
717
+ * Also this allows for building trimeshes with more than 1k verts (default convex hull limit)
716
718
  */
717
- skipHullCreation?: boolean;
719
+ forceCreateConvexHull?: boolean;
718
720
  }
719
721
 
720
722
  declare class BvhModule {
@@ -862,7 +864,9 @@ readonly linearDamping: -1;
862
864
  readonly angularDamping: -1;
863
865
  readonly firstPotentialConstraintPairEdge: PropertyDefinitionReference<ConstraintPairEdge | null, true>;
864
866
  readonly visitGeneration: PropertyDefinitionNumber<true>;
865
- }>> | undefined)[] | undefined;
867
+ }>> & {
868
+ world?: World | null;
869
+ })[] | undefined;
866
870
  maxLength?: number;
867
871
  }>;
868
872
  }>, PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap< {
@@ -974,7 +978,9 @@ readonly linearDamping: -1;
974
978
  readonly angularDamping: -1;
975
979
  readonly firstPotentialConstraintPairEdge: PropertyDefinitionReference<ConstraintPairEdge | null, true>;
976
980
  readonly visitGeneration: PropertyDefinitionNumber<true>;
977
- }>> | undefined)[] | undefined;
981
+ }>> & {
982
+ world?: World | null;
983
+ })[] | undefined;
978
984
  maxLength?: number;
979
985
  }>;
980
986
  }>> | undefined>;
@@ -1105,7 +1111,9 @@ export declare class BvhTree {
1105
1111
  readonly angularDamping: -1;
1106
1112
  readonly firstPotentialConstraintPairEdge: PropertyDefinitionReference<ConstraintPairEdge | null, true>;
1107
1113
  readonly visitGeneration: PropertyDefinitionNumber<true>;
1108
- }>> | undefined)[] | undefined;
1114
+ }>> & {
1115
+ world?: World | null;
1116
+ })[] | undefined;
1109
1117
  maxLength?: number;
1110
1118
  }>;
1111
1119
  }>, PropertyDefinitionMapInput<ConvertedInputPropertyDefinitionMap< {
@@ -1217,7 +1225,9 @@ export declare class BvhTree {
1217
1225
  readonly angularDamping: -1;
1218
1226
  readonly firstPotentialConstraintPairEdge: PropertyDefinitionReference<ConstraintPairEdge | null, true>;
1219
1227
  readonly visitGeneration: PropertyDefinitionNumber<true>;
1220
- }>> | undefined)[] | undefined;
1228
+ }>> & {
1229
+ world?: World | null;
1230
+ })[] | undefined;
1221
1231
  maxLength?: number;
1222
1232
  }>;
1223
1233
  }>> | undefined, BvhNode>;
@@ -2207,7 +2217,7 @@ readonly copyForDiff: PropertyDefinitionReference<ConvexHull | null, true>;
2207
2217
  }>> | undefined>;
2208
2218
 
2209
2219
  declare class ConvexHullBuilder {
2210
- buildFromPoints(vertices: Float32Array, convexRadius?: number, hullTolerance?: number, convexHullPool?: typeof ConvexHull.Pool, facePool?: typeof ConvexHullFace.Pool, numberValuePool?: typeof NumberValue.Pool, planePool?: typeof Plane.Pool, pointPool?: typeof ConvexHullPoint.Pool, shapeNoConvexPointsPool?: typeof Vec3.Pool): ConvexHull;
2220
+ buildFromPoints(vertices: Float32Array, convexRadius?: number, hullTolerance?: number, maxPoints?: number, maxVertexIndices?: number, convexHullPool?: typeof ConvexHull.Pool, facePool?: typeof ConvexHullFace.Pool, numberValuePool?: typeof NumberValue.Pool, planePool?: typeof Plane.Pool, pointPool?: typeof ConvexHullPoint.Pool, shapeNoConvexPointsPool?: typeof Vec3.Pool): ConvexHull;
2211
2221
  }
2212
2222
 
2213
2223
  declare class ConvexHullFace extends ConvexHullFace_base {
@@ -5200,7 +5210,7 @@ export declare class World {
5200
5210
  createCylinder(options: InputType<Cylinder>): NoInfer<WithPool<Cylinder>>;
5201
5211
  createCapsule(options: InputType<Capsule>): NoInfer<WithPool<Capsule>>;
5202
5212
  createTriangleMesh(params: BuildTriangleMeshParams): NoInfer<WithPool<TriangleMesh>>;
5203
- createConvexHull(vertices: Float32Array, convexRadius?: number, hullTolerance?: number): NoInfer<WithPool<ConvexHull>>;
5213
+ createConvexHull(vertices: Float32Array, convexRadius?: number, hullTolerance?: number, maxPoints?: number, maxVertexIndices?: number): NoInfer<WithPool<ConvexHull>>;
5204
5214
  createCompoundShape(params: {
5205
5215
  shape: Shape;
5206
5216
  transform: InputType<BasicTransform>;
package/build/bounce.js CHANGED
@@ -2854,64 +2854,6 @@ class ArrayPool {
2854
2854
  this._count = 0;
2855
2855
  }
2856
2856
  }
2857
- function coerceVec3Argument(obj, key) {
2858
- let value = obj[key];
2859
- if (!value) {
2860
- return;
2861
- }
2862
- if (Array.isArray(value)) {
2863
- value = { x: value[0], y: value[1], z: value[2] };
2864
- }
2865
- obj[key] = value;
2866
- }
2867
- function coerceQuatArgument(obj, key) {
2868
- let value = obj[key];
2869
- if (!value) {
2870
- return;
2871
- }
2872
- if (Array.isArray(value)) {
2873
- if (Array.length === 3) {
2874
- let x2 = value[0] * (180 / Math.PI);
2875
- let y4 = value[1] * (180 / Math.PI);
2876
- let z = value[2] * (180 / Math.PI);
2877
- let halfToRad = Math.PI / 360;
2878
- x2 *= halfToRad;
2879
- z *= halfToRad;
2880
- y4 *= halfToRad;
2881
- let sx = Math.sin(x2);
2882
- let cx = Math.cos(x2);
2883
- let sy = Math.sin(y4);
2884
- let cy = Math.cos(y4);
2885
- let sz = Math.sin(z);
2886
- let cz = Math.cos(z);
2887
- value = { x: 0, y: 0, z: 0, w: 0 };
2888
- value.x = sx * cy * cz + cx * sy * sz;
2889
- value.y = cx * sy * cz - sx * cy * sz;
2890
- value.z = cx * cy * sz + sx * sy * cz;
2891
- value.w = cx * cy * cz - sx * sy * sz;
2892
- }
2893
- } else if (!("w" in value)) {
2894
- let x2 = value.x * (180 / Math.PI);
2895
- let y4 = value.y * (180 / Math.PI);
2896
- let z = value.z * (180 / Math.PI);
2897
- let halfToRad = Math.PI / 360;
2898
- x2 *= halfToRad;
2899
- z *= halfToRad;
2900
- y4 *= halfToRad;
2901
- let sx = Math.sin(x2);
2902
- let cx = Math.cos(x2);
2903
- let sy = Math.sin(y4);
2904
- let cy = Math.cos(y4);
2905
- let sz = Math.sin(z);
2906
- let cz = Math.cos(z);
2907
- value = { x: 0, y: 0, z: 0, w: 0 };
2908
- value.x = sx * cy * cz + cx * sy * sz;
2909
- value.y = cx * sy * cz - sx * cy * sz;
2910
- value.z = cx * cy * sz + sx * sy * cz;
2911
- value.w = cx * cy * cz - sx * sy * sz;
2912
- }
2913
- obj[key] = value;
2914
- }
2915
2857
  function getCombinedFriction(bodyA, bodyB, fallbackFrictionFunction) {
2916
2858
  const frictionFunction = bodyA.frictionFunction !== bodyB.frictionFunction ? fallbackFrictionFunction : bodyA.frictionFunction;
2917
2859
  return coefficientFunctions[frictionFunction](bodyA.friction, bodyB.friction);
@@ -8094,10 +8036,28 @@ class Body extends createClass(bodyProps, { afterConstructorCode }) {
8094
8036
  get shape() {
8095
8037
  return this["shape" + this.shapeType];
8096
8038
  }
8097
- set shape(value) {
8039
+ set shape(newShape) {
8098
8040
  this["shape" + this.shapeType] = null;
8099
- this["shape" + value.type] = value;
8100
- this.shapeType = value.type;
8041
+ this["shape" + newShape.type] = newShape;
8042
+ this.shapeType = newShape.type;
8043
+ if (newShape.type === ShapeType.triangleMesh && this.type === 0 && !newShape.computedVolume) {
8044
+ const float32Array = new Float32Array(newShape.vertexPositions.length * 3);
8045
+ let index = 0;
8046
+ for (const vertexPosition of newShape.vertexPositions) {
8047
+ float32Array[index++] = vertexPosition.x;
8048
+ float32Array[index++] = vertexPosition.y;
8049
+ float32Array[index++] = vertexPosition.z;
8050
+ }
8051
+ const hull = this.world.triangleMeshBuilder.convexHullBuilder.buildFromPoints(
8052
+ float32Array,
8053
+ 0.02,
8054
+ 1e-3,
8055
+ Infinity,
8056
+ Infinity
8057
+ );
8058
+ newShape.computedVolume = hull.computedVolume;
8059
+ newShape.inertia.copy(hull.inertia);
8060
+ }
8101
8061
  updateBody(this);
8102
8062
  }
8103
8063
  // physics integration functions
@@ -8350,6 +8310,21 @@ class Body extends createClass(bodyProps, { afterConstructorCode }) {
8350
8310
  this.world.broadphase.markDynamicBodyAsDirty(this);
8351
8311
  }
8352
8312
  }
8313
+ const oldCreate$1 = Body.create;
8314
+ Body.create = function() {
8315
+ const data = arguments[0];
8316
+ const body2 = oldCreate$1.apply(this, arguments);
8317
+ body2.orientation.normalize();
8318
+ body2.previousPosition.copy(body2.position);
8319
+ body2.previousOrientation.copy(body2.orientation);
8320
+ if (data.world) {
8321
+ body2.world = data.world;
8322
+ }
8323
+ if (data.shape) {
8324
+ body2.shape = data.shape;
8325
+ }
8326
+ return body2;
8327
+ };
8353
8328
  const forcePointInWorldSpace = /* @__PURE__ */ Vec3.create();
8354
8329
  const impulsePointInWorldSpace = /* @__PURE__ */ Vec3.create();
8355
8330
  const angularDofsMask = /* @__PURE__ */ Vec3.create();
@@ -8364,20 +8339,6 @@ const deltaVelocity = /* @__PURE__ */ Vec3.create();
8364
8339
  const angularInverseMass = /* @__PURE__ */ Vec3.create();
8365
8340
  const rotationDelta = /* @__PURE__ */ Vec3.create();
8366
8341
  const isometry$1 = /* @__PURE__ */ Isometry.create();
8367
- const oldCreate$1 = Body.create;
8368
- Body.create = function() {
8369
- const data = arguments[0];
8370
- coerceVec3Argument(data, "position");
8371
- coerceQuatArgument(data, "orientation");
8372
- const body2 = oldCreate$1.apply(this, arguments);
8373
- body2.orientation.normalize();
8374
- body2.previousPosition.copy(body2.position);
8375
- body2.previousOrientation.copy(body2.orientation);
8376
- if (data.shape) {
8377
- body2.shape = data.shape;
8378
- }
8379
- return body2;
8380
- };
8381
8342
  function updateCenterOfMassPosition(body2) {
8382
8343
  shapeCenterOfMassInWorldSpace$1.copy(body2.shape.computedCenterOfMass);
8383
8344
  shapeCenterOfMassInWorldSpace$1.transformByQuat(body2.orientation);
@@ -14852,9 +14813,7 @@ const n = /* @__PURE__ */ Mat3.create();
14852
14813
  const adj_n = /* @__PURE__ */ Mat3.create();
14853
14814
  const transformedOffset = /* @__PURE__ */ Vec3.create();
14854
14815
  class ConvexHullBuilder {
14855
- buildFromPoints(vertices, convexRadius = 0.02, hullTolerance = 1e-3, convexHullPool = new ConvexHull.Pool(), facePool = new ConvexHullFace.Pool(), numberValuePool = new NumberValue.Pool(), planePool = new Plane.Pool(), pointPool = new ConvexHullPoint.Pool(), shapeNoConvexPointsPool = new Vec3.Pool()) {
14856
- const maxPoints = 1e3;
14857
- const maxVertexIndices = 1e3;
14816
+ buildFromPoints(vertices, convexRadius = 0.02, hullTolerance = 1e-3, maxPoints = 1e3, maxVertexIndices = 1e3, convexHullPool = new ConvexHull.Pool(), facePool = new ConvexHullFace.Pool(), numberValuePool = new NumberValue.Pool(), planePool = new Plane.Pool(), pointPool = new ConvexHullPoint.Pool(), shapeNoConvexPointsPool = new Vec3.Pool()) {
14858
14817
  const hull = ConvexHull.create({
14859
14818
  convexRadius,
14860
14819
  faces: { pool: facePool },
@@ -15130,8 +15089,8 @@ class TriangleMeshBuilder {
15130
15089
  nodes: { pool: nodes }
15131
15090
  }, bvhTreePool);
15132
15091
  mesh.bvh.build(mesh, triangles);
15133
- if (!params.skipHullCreation) {
15134
- const hull = this.convexHullBuilder.buildFromPoints(params.vertexPositions, 0, 1e-3);
15092
+ if (params.forceCreateConvexHull) {
15093
+ const hull = this.convexHullBuilder.buildFromPoints(params.vertexPositions, 0, 1e-3, Infinity, Infinity);
15135
15094
  mesh.computedVolume = hull.computedVolume;
15136
15095
  mesh.inertia.copy(hull.inertia);
15137
15096
  }
@@ -15624,11 +15583,13 @@ class World {
15624
15583
  shape.world = this;
15625
15584
  return shape;
15626
15585
  }
15627
- createConvexHull(vertices, convexRadius = 0.02, hullTolerance = 1e-3) {
15586
+ createConvexHull(vertices, convexRadius = 0.02, hullTolerance = 1e-3, maxPoints = 1e3, maxVertexIndices = 1e3) {
15628
15587
  const shape = this.convexHullBuilder.buildFromPoints(
15629
15588
  vertices,
15630
15589
  convexRadius,
15631
15590
  hullTolerance,
15591
+ maxPoints,
15592
+ maxVertexIndices,
15632
15593
  this.pools.convexHull,
15633
15594
  this.pools.convexHullFace,
15634
15595
  this.pools.convexHullNumberValue,
@@ -15698,6 +15659,7 @@ class World {
15698
15659
  createStaticBody(options) {
15699
15660
  options = options ?? {};
15700
15661
  options.type = BodyType.static;
15662
+ options.world = this;
15701
15663
  const body2 = this.staticBodies.create(options);
15702
15664
  const bodyCopy = this.staticBodyCopies.create(options);
15703
15665
  bodyCopy.copy(body2);
@@ -15709,22 +15671,22 @@ class World {
15709
15671
  createDynamicBody(options) {
15710
15672
  options = options ?? {};
15711
15673
  options.type = BodyType.dynamic;
15674
+ options.world = this;
15712
15675
  const body2 = this.dynamicBodies.create(options);
15713
15676
  const bodyCopy = this.dynamicBodyCopies.create(options);
15714
15677
  bodyCopy.copy(body2);
15715
15678
  body2.copyForDiff = bodyCopy;
15716
- body2.world = this;
15717
15679
  this.broadphase.addDynamicBody(body2);
15718
15680
  return body2;
15719
15681
  }
15720
15682
  createKinematicBody(options) {
15721
15683
  options = options ?? {};
15722
15684
  options.type = BodyType.kinematic;
15685
+ options.world = this;
15723
15686
  const body2 = this.kinematicBodies.create(options);
15724
15687
  const bodyCopy = this.kinematicBodyCopies.create(options);
15725
15688
  bodyCopy.copy(body2);
15726
15689
  body2.copyForDiff = bodyCopy;
15727
- body2.world = this;
15728
15690
  this.broadphase.addKinematicBody(body2);
15729
15691
  return body2;
15730
15692
  }
@@ -99,9 +99,10 @@ const world = new World({
99
99
  isWarmStartingEnabled: true,
100
100
 
101
101
  // contact manifold limits
102
- // by default since 1.3.0, these are unlimited
102
+ // by default since v1.3.0, these are unlimited
103
103
  // if set to a finite amount, an error is thrown when an allocation is attempted past the limit
104
104
  // this may be desired during development to stay within a strict memory budget, for example
105
+ // 1024 is a reasonable limit for many use cases (it was the default prior to v1.3.0)
105
106
  contactManifoldOptions: {
106
107
  maxContactManifolds: Infinity,
107
108
  maxContactPairs: Infinity,
@@ -142,7 +143,9 @@ const vertexPositions = new Float32Array([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1]);
142
143
  const shape = world.createConvexHull(
143
144
  vertexPositions, // Float32Array of vertex positions
144
145
  0.02, // convexRadius (optional, default 0.02)
145
- 1e-3 // hullTolerance (optional, default 1e-3)
146
+ 1e-3, // hullTolerance (optional, default 1e-3 = 0.001)
147
+ 1000, // maxPoints (optional, default 1000)
148
+ 1000 // maxVertexIndices (optional, default 1000)
146
149
  );
147
150
 
148
151
  const body = world.createDynamicBody({ shape: shape, position: [0, 0, 5] });
@@ -169,7 +172,11 @@ const indices = new Uint32Array([
169
172
  const shape = world.createTriangleMesh({
170
173
  vertexPositions: vertices,
171
174
  faceIndices: indices,
172
- skipHullCreation: true, // skip hull for static-only meshes (allows >1k verts)
175
+
176
+ // optional, if you want to estimate the volume or inertia tensor based on the convex hull
177
+ // note that a convex hull is automatically created if a triangle mesh is used as a dynamic body
178
+ // that said, triangle meshes are generally not recommended as dynamic bodies, for performance reasons
179
+ forceCreateConvexHull: false,
173
180
  });
174
181
 
175
182
  const body = world.createStaticBody({ shape: shape });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perplexdotgg/bounce",
3
- "version": "1.2.5",
3
+ "version": "1.3.0",
4
4
  "license": "MIT",
5
5
  "description": "Bounce",
6
6
  "main": "./build/bounce.js",