Skip to content

Rectangle.GetPenetration(Rectangle) Method

Definition

Namespace: Brine2D.Core

Gets the penetration depth when intersecting with another rectangle. Returns zero vector if not intersecting. Useful for collision response (pushing objects apart).

public System.Numerics.Vector2 GetPenetration(Brine2D.Core.Rectangle other);

Parameters

other Rectangle

Returns

System.Numerics.Vector2

Remarks

The returned vector points in the direction to push this rectangle to separate it from the other rectangle. The magnitude is the minimum distance needed to separate them.