From 3cbff6bd7bd3591a4901c17aa6ad53cb909070f0 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Tue, 6 Feb 2018 16:25:07 +0200 Subject: [PATCH] Fixed circular physics bodies not being rendered in debugdraw if the radius is less than 1.28f --- .../BarotraumaClient/Source/Physics/PhysicsBody.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Barotrauma/BarotraumaClient/Source/Physics/PhysicsBody.cs b/Barotrauma/BarotraumaClient/Source/Physics/PhysicsBody.cs index fab035355..adee95ace 100644 --- a/Barotrauma/BarotraumaClient/Source/Physics/PhysicsBody.cs +++ b/Barotrauma/BarotraumaClient/Source/Physics/PhysicsBody.cs @@ -67,7 +67,7 @@ namespace Barotrauma { switch (BodyShape) { - case PhysicsBody.Shape.Rectangle: + case Shape.Rectangle: { float maxSize = Math.Max(ConvertUnits.ToDisplayUnits(width), ConvertUnits.ToDisplayUnits(height)); if (maxSize > 128.0f) @@ -84,7 +84,7 @@ namespace Barotrauma (int)ConvertUnits.ToDisplayUnits(height * bodyShapeTextureScale)); break; } - case PhysicsBody.Shape.Capsule: + case Shape.Capsule: { float maxSize = Math.Max(ConvertUnits.ToDisplayUnits(radius), ConvertUnits.ToDisplayUnits(Math.Max(height, width))); if (maxSize > 128.0f) @@ -101,18 +101,22 @@ namespace Barotrauma (int)ConvertUnits.ToDisplayUnits(Math.Max(height, width) * bodyShapeTextureScale)); break; } - case PhysicsBody.Shape.Circle: - if (ConvertUnits.ToDisplayUnits(radius)> 128.0f) + case Shape.Circle: + if (ConvertUnits.ToDisplayUnits(radius) > 128.0f) { bodyShapeTextureScale = 128.0f / ConvertUnits.ToDisplayUnits(radius); } + else + { + bodyShapeTextureScale = 1.0f; + } bodyShapeTexture = GUI.CreateCircle((int)ConvertUnits.ToDisplayUnits(radius * bodyShapeTextureScale)); break; } } float rot = -DrawRotation; - if (bodyShape == PhysicsBody.Shape.Capsule && width > height) + if (bodyShape == Shape.Capsule && width > height) { rot -= MathHelper.PiOver2; }