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, 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, LengthPoint2 ContactPoint)
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.
ContactPointLengthPoint2The world-space point where contact occurs — the closest point on shape B's surface to shape A at the moment of collision.
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
ContactPoint
The world-space point where contact occurs — the closest point on shape B's surface to shape A at the moment of collision.
public LengthPoint2 ContactPoint { 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; }