polygon MOI

This commit is contained in:
2023-02-27 14:50:36 +00:00
parent 4510543aaf
commit b6788e25b1
2 changed files with 12 additions and 1 deletions

View File

@@ -365,7 +365,13 @@ struct phys2d_poly *Make2DPoly(int go)
float phys2d_poly_moi(struct phys2d_poly *poly, float m)
{
return cpMomentForPoly(m, arrlen(poly->points), poly->points, cpvzero, poly->radius);
float moi = cpMomentForPoly(m, arrlen(poly->points), poly->points, cpvzero, poly->radius);
if (moi <= 0) {
YughError("Polygon MOI is negative. Returning one;");
return 1;
}
return moi;
}
void phys2d_polydel(struct phys2d_poly *poly)