Skip to content
EvilEngine.Formats.Collision

ColliderShape.Hull record

public sealed record ColliderShape.Hull : ColliderShape

A collider shape that’s the convex hull of a set of points about the collider’s origin, as each convex piece of a Source .phy is. The physics world wraps the points, so a point inside the hull changes nothing and a hollow can’t be made with one: build a concave shape from several hulls.

var wedge = new ColliderShape.Hull([
    new(0, 0, 0), new(1, 0, 0), new(0, 0, 1), new(1, 0, 1), new(0, 0.5f, 0), new(0, 0.5f, 1)
]);
Assembly
EvilEngine.Formats
Commit
4ff877b1

Members

ColliderShape.Hull constructor

public ColliderShape.Hull(Vector3[] Points)

Makes a hull of points, with no faces given.

Points property

public Vector3[] Points { get; init; }

The hull’s corners in metres. It needs at least four, every one finite, for the collision to be written.

Faces property

public uint[]? Faces { get; init; }

The hull’s faces as triangles, three indices into Points each, or null. The physics world doesn’t need them, but a body’s volume, and so a mass worked out from it, is measured from them. Left null, the engine works the faces out itself for a hull of up to 96 points. A bigger hull with no faces counts no volume. .phy hulls carry their own.