mirror of
https://github.com/liabru/matter-js.git
synced 2025-01-12 16:08:50 -05:00
removed complexity check in Bodies.fromVertices, enforce clockwise sort
This commit is contained in:
parent
90adf147e9
commit
2d1ef0d6d4
1 changed files with 2 additions and 8 deletions
|
@ -191,7 +191,7 @@ var Bodies = {};
|
|||
// vertices are convex, so just create a body normally
|
||||
body = {
|
||||
position: { x: x, y: y },
|
||||
vertices: vertices
|
||||
vertices: Vertices.clockwiseSort(vertices)
|
||||
};
|
||||
|
||||
return Body.create(Common.extend({}, body, options));
|
||||
|
@ -209,12 +209,6 @@ var Bodies = {};
|
|||
concave.vertices.push([vertices[i].x, vertices[i].y]);
|
||||
}
|
||||
|
||||
// check for complexity
|
||||
if (!concave.isSimple()) {
|
||||
Common.log('Bodies.fromVertices: Non-simple polygons are not supported. Could not decompose vertices. Fallback to convex hull.', 'warn');
|
||||
canDecompose = false;
|
||||
}
|
||||
|
||||
// try to decompose
|
||||
if (canDecompose) {
|
||||
// vertices are concave and simple, we can decompose into parts
|
||||
|
|
Loading…
Reference in a new issue