0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2025-01-31 18:14:55 -05:00

Matter.Bodies.fromVertices fix: no longer returns 'undefined'

This commit is contained in:
Zhijie Xia 2022-06-14 20:18:05 -06:00
parent 014ef77d1e
commit b5db500807

View file

@ -303,6 +303,21 @@ var Vector = require('../geometry/Vector');
}
}
if(parts.length==0)
{
for (v = 0; v < vertexSets.length; v += 1) {
vertices = vertexSets[v];
vertices = Vertices.hull(vertices);
parts.push({
position: { x: x, y: y },
vertices: vertices
});
}
}
// create body parts
for (i = 0; i < parts.length; i++) {
parts[i] = Body.create(Common.extend(parts[i], options));