Plush

MatterFracture#

PlushEngine · Type index

Namespace: PlushEngine.Matter (using PlushEngine.Matter;)

Pre-baked fracture of a convex mesh (the pieces exist before any impact; runtime only decides which break away). Voronoi clips by the bisector planes between seeds; Brick clips box walls into staggered XY courses. Generated shared interior faces are bonded. Structural nodes map to the piece whose seed is nearest, so the damage field decides what breaks.

public sealed class MatterFracture

General: BondA · BondB · BondPlanes · Build · CanFracture · FindPiece · MeshId · NodePiece · PieceMesh · PieceProbe · PieceVertices · Seeds · Volumes

General#

BondA#

public int[] BondA { get; init; }

Initial value: Array.Empty<int>()

BondB#

public int[] BondB { get; init; }

Initial value: Array.Empty<int>()

BondPlanes#

public Vector4[] BondPlanes { get; init; }

Initial value: []

Shared cut planes in mesh space (normal XYZ, distance W), one per bond.

Build#

public static MatterFracture Build(MeshAsset mesh, MatterStructure structure, int pieces, int seed, Vector3? scale = null, MatterFracturePattern pattern = MatterFracturePattern.Voronoi);
ParameterDescription
scaleThe occurrence's scale: cells are cut in the scaled shape (so a long wall breaks into chunks, not planks) and stored back in mesh space.

CanFracture#

public static bool CanFracture(MeshAsset mesh);

True for meshes this bake can cut: the built-in convex primitives and the convex generated kinds (a box with any bevel, a closed cylinder or cone, a wedge).

FindPiece#

public int FindPiece(Vector3 point, Vector3 scale);

The cell containing a mesh-space point; falls back to the nearest seed outside the mesh.

MeshId#

public string MeshId { get; init; }

Initial value: ""

Stable prefix for the pieces' mesh identities.

NodePiece#

public int[] NodePiece { get; init; }

Initial value: Array.Empty<int>()

For each structural node, its piece.

PieceMesh#

public MeshAsset PieceMesh(int piece);

The piece's mesh (built once from PieceVertices; generated meshes are not packaged as files).

PieceProbe#

public int[] PieceProbe { get; init; }

Initial value: Array.Empty<int>()

For each piece, the structural node nearest its seed. Interior pieces own no (surface) nodes, so they read their damage here as well; without it they could never break.

PieceVertices#

public float[][] PieceVertices { get; init; }

Initial value: Array.Empty<float[]>()

Per piece: triangle-list vertices (position, normal, uv; 8 floats) in mesh space.

Seeds#

public Vector3[] Seeds { get; init; }

Initial value: Array.Empty<Vector3>()

Volumes#

public float[] Volumes { get; init; }

Initial value: Array.Empty<float>()

MatterFracturePattern · MatterStructure · MeshAsset

Source#