stable collisions
This commit is contained in:
@@ -24,13 +24,11 @@ namespace PhysicsEngine
|
||||
|
||||
Color outlineColor = GetDarkerColor(fillColor);
|
||||
|
||||
// 1. Draw the outer outline rectangle (exact original size, outline colour)
|
||||
Vector2 outerSizePixels = sizePixels;
|
||||
Vector2 outerOrigin = outerSizePixels * 0.5f;
|
||||
Rectangle outerRec = new Rectangle(positionPixels.X, positionPixels.Y, outerSizePixels.X, outerSizePixels.Y);
|
||||
Raylib.DrawRectanglePro(outerRec, outerOrigin, rotationDegrees, outlineColor);
|
||||
|
||||
// 2. Draw the inner fill rectangle, reduced by outlineThickness on all sides
|
||||
Vector2 innerSizePixels = new Vector2(
|
||||
MathF.Max(0, sizePixels.X - outlineThickness),
|
||||
MathF.Max(0, sizePixels.Y - outlineThickness)
|
||||
@@ -46,14 +44,11 @@ namespace PhysicsEngine
|
||||
float radiusPixels = radius * pixelsPerMeter;
|
||||
Color outlineColor = GetDarkerColor(fillColor);
|
||||
|
||||
// 1. Draw outer circle (outline colour, exact radius)
|
||||
Raylib.DrawCircleV(positionPixels, radiusPixels, outlineColor);
|
||||
|
||||
// 2. Draw inner circle (fill colour, radius reduced by outlineThickness)
|
||||
float innerRadius = MathF.Max(0, radiusPixels - outlineThickness);
|
||||
Raylib.DrawCircleV(positionPixels, innerRadius, fillColor);
|
||||
|
||||
// Draw rotation indicator line inside the fill (same as before, but from centre to inner edge)
|
||||
float cos = MathF.Cos(rotationRadians);
|
||||
float sin = MathF.Sin(rotationRadians);
|
||||
Vector2 edge = positionPixels + new Vector2(cos, sin) * innerRadius;
|
||||
|
||||
Reference in New Issue
Block a user