class MAGES::MeshDeformations::TriangularMesh

Overview

class TriangularMesh: public MonoBehaviour
{
public:
    // classes

    class MeshSection;

    // fields

    bool automaticInitializationOnStart = false;
    bool deformable = true;

    // properties

    bool IsInitialized;
    bool IsStatic;
    Vector3[] Vertices;
    int VertexCount;
    Vector3[] Normals;
    int[] Triangles;
    int TriangleCount;
    bool HasUVs;
    Vector2[] UV1;
    List SubMeshes;
    Mesh Mesh;
    MeshFilter MeshFilter;
    MeshRenderer MeshRenderer;
    SkinnedMeshRenderer SkinnedMeshRenderer;
    Vector3[] SkinnedVertices;
    NativeArray BoneWeights;
    NativeArray BonesPerVertex;
    Transform[] Bones;
    Matrix4x4[] Bindposes;
    Transform RootBone;
    float SectionSize;
    int SectionCount;
    List Sections;

    // methods

    void ApplyNewValuesToMesh();
    void Initialize();
    void OnEnable();
    void Start();
    void Update();
    void LateUpdate();

    void GetTearSections(
        UtilitiesHelper.Hexahedron hexahedron,
        out List tearSections,
        out List unaffectedSections,
        out MeshSection completeAffectedSection,
        out List indexes
    );

    List GetCutSections(Plane cutPlane);
    void RecalculateBoundingBoxes();
};

Detailed Documentation

Fields

bool automaticInitializationOnStart = false

If set to true, deformable mesh will be initialized on Start if not already initialized.

bool deformable = true

Set to true if cut/tear/drill deformations should be allowed, false otherwise.

Methods

void ApplyNewValuesToMesh()

Applies the values of the arrays in the Renderer.

void GetTearSections(
    UtilitiesHelper.Hexahedron hexahedron,
    out List tearSections,
    out List unaffectedSections,
    out MeshSection completeAffectedSection,
    out List indexes
)

Returns the sections intersecting the tear box.

Parameters:

tearSegment

The planes defining a tear segment

Returns:

void RecalculateBoundingBoxes()

Resizes the Bounding Boxes of the Mesh to completely encapsulate their assigned Triangles. Only for SkinnedMeshes.