Struct CollisionManifold
Data returned by a successful collision test: how deeply two shapes overlap, which direction to push them apart, and where the contact occurs.
public readonly record struct CollisionManifold : IEquatable<CollisionManifold>
- Implements
- Inherited Members
Remarks
Normal convention: ContactNormal points from shape B toward shape A. Applying PushOut to A's position resolves the penetration.
Calls of the form a.TryGetManifold(b, out m) and b.TryGetManifold(a, out m)
produce consistent results: opposite normals, equal depths.
Constructors
CollisionManifold(Length, Direction2, IReadOnlyList<LengthPoint2>)
Data returned by a successful collision test: how deeply two shapes overlap, which direction to push them apart, and where the contact occurs.
public CollisionManifold(Length PenetrationDepth, Direction2 ContactNormal, IReadOnlyList<LengthPoint2> ContactPoints)
Parameters
PenetrationDepthLengthHow deeply the two shapes overlap. Always positive when a manifold is returned.
ContactNormalDirection2Unit normal pointing from B toward A. Add PushOut to A's position to resolve the overlap.
ContactPointsIReadOnlyList<LengthPoint2>World-space points where contact occurs. Circle–circle collisions produce one point; face-on-face contacts (e.g., rectangle resting on rectangle) may produce two.
Remarks
Normal convention: ContactNormal points from shape B toward shape A. Applying PushOut to A's position resolves the penetration.
Calls of the form a.TryGetManifold(b, out m) and b.TryGetManifold(a, out m)
produce consistent results: opposite normals, equal depths.
Properties
ContactNormal
Unit normal pointing from B toward A. Add PushOut to A's position to resolve the overlap.
public Direction2 ContactNormal { get; init; }
Property Value
ContactPoints
World-space points where contact occurs. Circle–circle collisions produce one point; face-on-face contacts (e.g., rectangle resting on rectangle) may produce two.
public IReadOnlyList<LengthPoint2> ContactPoints { get; init; }
Property Value
PenetrationDepth
How deeply the two shapes overlap. Always positive when a manifold is returned.
public Length PenetrationDepth { get; init; }
Property Value
- Length
PushOut
The displacement vector that, when added to A's position, fully resolves the penetration.
Equivalent to ContactNormal * PenetrationDepth.
public LengthVector2 PushOut { get; }