@perplexdotgg/bounce 1.0.5 → 1.0.6
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 +7 -0
- package/build/bounce.js +5 -3
- package/package.json +1 -1
package/build/bounce.d.ts
CHANGED
|
@@ -2151,6 +2151,13 @@ readonly z: PropertyDefinitionNumber<true>;
|
|
|
2151
2151
|
declare interface BuildTriangleMeshParams {
|
|
2152
2152
|
vertexPositions: Float32Array;
|
|
2153
2153
|
faceIndices: Uint32Array;
|
|
2154
|
+
/**
|
|
2155
|
+
* If true, skips the creation of a convex hull for the triangle mesh.
|
|
2156
|
+
* The hull is only used for dynamic bodies, so if the trimesh is only intended
|
|
2157
|
+
* for static bodies, this can be set to true to save computation time.
|
|
2158
|
+
* Also this allows for building trimeshes with more than 1k verts (hull limit)
|
|
2159
|
+
*/
|
|
2160
|
+
skipHullCreation?: boolean;
|
|
2154
2161
|
}
|
|
2155
2162
|
|
|
2156
2163
|
declare class BvhModule {
|
package/build/bounce.js
CHANGED
|
@@ -16123,9 +16123,11 @@ class TriangleMeshBuilder {
|
|
|
16123
16123
|
nodes: { pool: nodes }
|
|
16124
16124
|
}, bvhTreePool);
|
|
16125
16125
|
mesh.bvh.build(mesh, triangles);
|
|
16126
|
-
|
|
16127
|
-
|
|
16128
|
-
|
|
16126
|
+
if (!params.skipHullCreation) {
|
|
16127
|
+
const hull = this.convexHullBuilder.buildFromPoints(params.vertexPositions, 0, 1e-3);
|
|
16128
|
+
mesh.computedVolume = hull.computedVolume;
|
|
16129
|
+
mesh.inertia.copy(hull.inertia);
|
|
16130
|
+
}
|
|
16129
16131
|
return mesh;
|
|
16130
16132
|
}
|
|
16131
16133
|
}
|