Vixen
02b45cc4
csharp
public static class MeshCollision

Collision shapes worked out from a block-out mesh.

Read the guide page for this →

Remarks

Doc 24's P7: "box per convex piece, or the mesh itself". A block-out is what a level is walked around in long before it is what it looks like, and a designer who has to author collision by hand for geometry they will throw away next week does not author it at all.

⚠ A box per connected shell rather than per convex piece, and the difference is stated rather than glossed. Convex decomposition is a research problem with a well-known set of approximate answers, none of them cheap; a shell is what EditMesh can already tell you exactly. For a block-out the two mostly coincide, because a block-out is made of boxes joined into rooms — and where they do not, the box is bigger than the geometry, which is the safe direction to be wrong in for something you walk on and the wrong direction for something you shoot through. Which of the two matters is what Triangles is for.

⚠ Nothing here builds a ShapeDescription, and that is doc 24's D1 rather than an omission. A hull, a mesh or a compound is registered by its data with a live physics world and the description holds the resulting index — see ShapeDescription's own remarks — so what a geometry kernel can produce is the data and what turns it into a shape is the host that has a world.

Methods (3)

  • public static int Shells(EditMesh mesh, List<int> into)

    Which shell each face belongs to, and how many there are.

  • public static int Boxes(EditMesh mesh, List<BoundingBox> into)

    A box round each of the mesh's shells.

  • public static (Vector3[] Positions, int[] Indices) Triangles(EditMesh mesh)

    The mesh as a triangle soup, for the collision that has to be exact.

Used by (1)

  • BlockoutHandoffVixen.Editor.Blockout