Fixed circular physics bodies not being rendered in debugdraw if the radius is less than 1.28f
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user