Fixed map collider generation

I didn't realize the bodies were generated in the same method that generates the mesh triangles, TODO consider splitting that
This commit is contained in:
juanjp600
2017-06-21 18:45:06 -03:00
parent 7ab01b8237
commit 6b65e94d41
2 changed files with 5 additions and 3 deletions

View File

@@ -347,9 +347,10 @@ namespace Barotrauma
return pathCells;
}
public static List<Body> GeneratePolygons(List<VoronoiCell> cells, out List<VertexPositionTexture> verticeList, bool setSolid=true)
{
//TODO: consider separating body generation from render triangle generation
verticeList = new List<VertexPositionTexture>();
var bodies = new List<Body>();

View File

@@ -440,16 +440,17 @@ namespace Barotrauma
List<VoronoiCell> cellsWithBody = new List<VoronoiCell>(cells);
#if CLIENT
List<VertexPositionTexture> bodyVertices;
bodies = CaveGenerator.GeneratePolygons(cellsWithBody, out bodyVertices);
#if CLIENT
renderer.SetBodyVertices(bodyVertices.ToArray());
renderer.SetWallVertices(CaveGenerator.GenerateWallShapes(cells));
renderer.PlaceSprites(generationParams.BackgroundSpriteAmount);
#endif
ShaftBody = BodyFactory.CreateEdge(GameMain.World,
ConvertUnits.ToSimUnits(new Vector2(borders.X, 0)),
ConvertUnits.ToSimUnits(new Vector2(borders.Right, 0)));