class MAGES::MeshDeformations::SkinnedMeshUtilities

Overview

class SkinnedMeshUtilities
{
public:
    // structs

    struct VertexWeightCalculationInfo;

    // methods

    static Vector3[] SkinMeshVerticesToWorldSpace(ref SkinnedMeshRenderer smr);

    static void SkinMeshVerticesToWorldSpace(
        ref Mesh mesh,
        ref Vector3[] vertices,
        ref Transform[] bones,
        ref Matrix4x4[] bindposes,
        ref Vector3[] skinnedVertices
    );

    static void GenerateNewVertexWeights(
        ref List newVerticesInfo,
        ref BoneWeight[] boneWeights
    );

    static void GenerateNewVertexWeights(
        ref List newVerticesInfo,
        ref NativeArray bonesPerVertex,
        ref NativeArray boneWeights
    );
};

Detailed Documentation

Methods

static Vector3[] SkinMeshVerticesToWorldSpace(ref SkinnedMeshRenderer smr)

Bakes a skinned mesh at the position shown in the screen.

Parameters:

smr

The SkinnedMeshRenderer from which to Read the Mesh and Bones

boneTransformsAtBakeMoment

The transform of the bones at the moment of baking the mesh

Returns:

The skinned vertices

static void SkinMeshVerticesToWorldSpace(
    ref Mesh mesh,
    ref Vector3[] vertices,
    ref Transform[] bones,
    ref Matrix4x4[] bindposes,
    ref Vector3[] skinnedVertices
)

Bakes a skinned mesh at the position shown in the screen.

static void GenerateNewVertexWeights(
    ref List newVerticesInfo,
    ref BoneWeight[] boneWeights
)

Calculates the new vertex weights (Only 4 bones per vertex).

Parameters:

newVerticesInfo

boneWeights

static void GenerateNewVertexWeights(
    ref List newVerticesInfo,
    ref NativeArray bonesPerVertex,
    ref NativeArray boneWeights
)

Calculates the new vertex weights (Unlimited bones per vertex).

Parameters:

newVerticesInfo

bonesPerVertex

boneWeights