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:
parent
014ef77d1e
commit
b5db500807
1 changed files with 15 additions and 0 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Reference in a new issue