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:
@@ -421,9 +421,9 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
//don't create a triangle if any of the vertices are too close to each other
|
//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)
|
//(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 ||
|
if (Vector2.DistanceSquared(triangles[i][0], triangles[i][1]) < 0.006f ||
|
||||||
Vector2.Distance(triangles[i][0], triangles[i][2]) < 0.05f ||
|
Vector2.DistanceSquared(triangles[i][0], triangles[i][2]) < 0.006f ||
|
||||||
Vector2.Distance(triangles[i][1], triangles[i][2]) < 0.05f) continue;
|
Vector2.DistanceSquared(triangles[i][1], triangles[i][2]) < 0.006f) continue;
|
||||||
|
|
||||||
Vertices bodyVertices = new Vertices(triangles[i]);
|
Vertices bodyVertices = new Vertices(triangles[i]);
|
||||||
var newFixture = FixtureFactory.AttachPolygon(bodyVertices, 5.0f, cellBody);
|
var newFixture = FixtureFactory.AttachPolygon(bodyVertices, 5.0f, cellBody);
|
||||||
|
|||||||
Reference in New Issue
Block a user