From 6b65e94d4172f761783b02a0f1fffaaf4129ccae Mon Sep 17 00:00:00 2001 From: juanjp600 Date: Wed, 21 Jun 2017 18:45:06 -0300 Subject: [PATCH] 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 --- BarotraumaShared/Source/Map/Levels/CaveGenerator.cs | 3 ++- BarotraumaShared/Source/Map/Levels/Level.cs | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/BarotraumaShared/Source/Map/Levels/CaveGenerator.cs b/BarotraumaShared/Source/Map/Levels/CaveGenerator.cs index bb9a182f6..db35a027b 100644 --- a/BarotraumaShared/Source/Map/Levels/CaveGenerator.cs +++ b/BarotraumaShared/Source/Map/Levels/CaveGenerator.cs @@ -347,9 +347,10 @@ namespace Barotrauma return pathCells; } - + public static List GeneratePolygons(List cells, out List verticeList, bool setSolid=true) { + //TODO: consider separating body generation from render triangle generation verticeList = new List(); var bodies = new List(); diff --git a/BarotraumaShared/Source/Map/Levels/Level.cs b/BarotraumaShared/Source/Map/Levels/Level.cs index 9207704f8..87cf7682f 100644 --- a/BarotraumaShared/Source/Map/Levels/Level.cs +++ b/BarotraumaShared/Source/Map/Levels/Level.cs @@ -440,16 +440,17 @@ namespace Barotrauma List cellsWithBody = new List(cells); -#if CLIENT List 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)));