Add drawing RigidBody center of mass and attached colliders

#2325 #3247
This commit is contained in:
Wojtek Figat
2025-10-08 22:16:16 +02:00
parent 73976f3ed9
commit e2fc8a6283
11 changed files with 75 additions and 11 deletions

View File

@@ -111,18 +111,11 @@ namespace
}
}
void BoxCollider::OnDebugDrawSelected()
void BoxCollider::OnDebugDrawSelf()
{
const Color color = Color::GreenYellow;
DEBUG_DRAW_WIRE_BOX(_bounds, color * 0.3f, 0, false);
if (_contactOffset > 0)
{
OrientedBoundingBox contactBounds = _bounds;
contactBounds.Extents += Vector3(_contactOffset) / contactBounds.Transformation.Scale;
DEBUG_DRAW_WIRE_BOX(contactBounds, Color::Blue.AlphaMultiplied(0.2f), 0, false);
}
Vector3 corners[8];
_bounds.GetCorners(corners);
const float margin = Math::Min(1.0f, _bounds.GetSize().MinValue() * 0.01f);
@@ -146,8 +139,19 @@ void BoxCollider::OnDebugDrawSelected()
{
DEBUG_DRAW_WIRE_BOX(_bounds, wiresColor, 0, true);
}
}
void BoxCollider::OnDebugDrawSelected()
{
OnDebugDrawSelf();
if (_contactOffset > 0)
{
OrientedBoundingBox contactBounds = _bounds;
contactBounds.Extents += Vector3(_contactOffset) / contactBounds.Transformation.Scale;
DEBUG_DRAW_WIRE_BOX(contactBounds, Color::Blue.AlphaMultiplied(0.2f), 0, false);
}
// Base
Collider::OnDebugDrawSelected();
}