Skip to content
EvilEngine.Formats.Collision

ColliderShape.Mesh record

public sealed record ColliderShape.Mesh : ColliderShape

A collider shape of triangles, which need not close or be convex, for the world and things that never move: a map’s displacements, a Bunker or Overgrowth model’s own collision. A body holding one can only be static or kinematic. IPhysicsWorld.Add refuses a dynamic one with ArgumentException, and it counts no volume toward a body’s mass. In a body made there, its triangles collide from both sides.

var floor = new ColliderShape.Mesh([
    new MeshPart([new(-5, 0, -5), new(5, 0, -5), new(-5, 0, 5), new(5, 0, 5)], [0, 2, 1, 1, 2, 3], CollisionSurface.None)
]);
Assembly
EvilEngine.Formats
Commit
4ff877b1

Members

ColliderShape.Mesh constructor

public ColliderShape.Mesh(IReadOnlyList<MeshPart> Parts)

Makes a mesh of parts.

Parts property

public IReadOnlyList<MeshPart> Parts { get; init; }

The mesh’s parts, each a MeshPart of corners in metres, triangles as three indices into them each, and its own CollisionSurface, so one mesh can be concrete in one place and metal in another. The mesh’s own Surface isn’t written: its parts’ are. It needs at least one part, and every part whole triangles of its own corners, to be written.