Table of Contents

Struct CollisionManifold

Namespace
Thunder.UnitsNET.Vectors.Geometry
Assembly
Thunder.UnitsNET.Vectors.Geometry.dll

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

PenetrationDepth Length

How deeply the two shapes overlap. Always positive when a manifold is returned.

ContactNormal Direction2

Unit normal pointing from B toward A. Add PushOut to A's position to resolve the overlap.

ContactPoints IReadOnlyList<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

Direction2

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

IReadOnlyList<LengthPoint2>

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; }

Property Value

LengthVector2
v0.4.0-preview6 ▼