I don't know if your are still working on this engine, I have found a small misbehavior in the createShape() method in NapePhysicsObject when you parse a polyline from a tiled file. You use Vec2.weak() to push the vertices, so they can only be passed once to a nape method. If the ValidationResult is CONCAVE, the vertices are already disposed and the convexDecomposition() method returns an empty GeomPolyList.
Fix suggenstion:
var geomPoly:GeomPoly = new GeomPoly(verts);
var polygon:Polygon = new Polygon(geomPoly, _material);
var validation:ValidationResult = polygon.validity();
if (validation == ValidationResult.VALID)
_shape = polygon;
else if (validation == ValidationResult.CONCAVE) {
var convex:GeomPolyList = geomPoly.convexDecomposition();
convex.foreach(function(p:GeomPoly):void {
_body.shapes.add(new Polygon(p));
});
return;
} else
throw new Error("Invalid polygon/polyline");
I don't know if your are still working on this engine, I have found a small misbehavior in the createShape() method in NapePhysicsObject when you parse a polyline from a tiled file. You use Vec2.weak() to push the vertices, so they can only be passed once to a nape method. If the ValidationResult is CONCAVE, the vertices are already disposed and the convexDecomposition() method returns an empty GeomPolyList.
Fix suggenstion: