@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
15 lines (14 loc) • 420 B
JavaScript
;
export function createPhysicsConvexHull(PhysicsLib2, object) {
const geometry = object.geometry;
if (!geometry) {
return;
}
const nonIndexedGeometry = geometry.toNonIndexed();
const position = nonIndexedGeometry.getAttribute("position");
if (!position) {
return;
}
const float32Array = new Float32Array(position.array);
return PhysicsLib2.ColliderDesc.convexHull(float32Array);
}