Increased the minimum distance between verts in level collider generation code. Should make the "invalid triangle created by CaveGenerator" errors less frequent. (See #311)

This commit is contained in:
Joonas Rikkonen
2018-07-24 15:43:26 +03:00
parent e21b756f29
commit 756278bb81
@@ -421,9 +421,9 @@ namespace Barotrauma
{
//don't create a triangle if any of the vertices are too close to each other
//(apparently Farseer doesn't like polygons with a very small area, see Shape.ComputeProperties)
if (Vector2.Distance(triangles[i][0], triangles[i][1]) < 0.05f ||
Vector2.Distance(triangles[i][0], triangles[i][2]) < 0.05f ||
Vector2.Distance(triangles[i][1], triangles[i][2]) < 0.05f) continue;
if (Vector2.DistanceSquared(triangles[i][0], triangles[i][1]) < 0.006f ||
Vector2.DistanceSquared(triangles[i][0], triangles[i][2]) < 0.006f ||
Vector2.DistanceSquared(triangles[i][1], triangles[i][2]) < 0.006f) continue;
Vertices bodyVertices = new Vertices(triangles[i]);
var newFixture = FixtureFactory.AttachPolygon(bodyVertices, 5.0f, cellBody);