MD Package Technical & APi Documentation
MDM_Morpher :: MD_ModifierBase
Namespace: MDPackage.Modifiers
Blend mesh between list of stored & captured shapes.
Read more here (Online documentation slide)
Public Methods
// Update current mesh state (if Update Every Frame is disabled)
public void Morpher_UpdateMesh()
// Change current target morph mesh index
public void Morpher_ChangeMeshIndex(int entry)
// Set current blend value (01)
public void Morpher_SetBlendValue(float entry)
// Register assigned blend shapes and create unique list of vertices ready for blending
public void Morpher_RegisterBlendShapes()
Public Fields and Properties
public bool enableInterpolation = false;
public float interpolationSpeed = 0.5f;

[Range(0.0f, 1.0f)] public float blendValue = 0;

public Mesh[] targetBlendShapes;
public int targetBlendShapeIndex = 0;

public bool resetVertexStateOnChange = true;

public List<RegisteredBlendShapes> registeredBlendShapes;
public int PreviousRegisteredBlends { get; }
Examples
The following paragraphs contain Morpher modifier used in a practical example. Register specific morph shapes via script.
using UnityEngine;
using MDPackage.Modifiers;

[RequireComponent(typeof(MeshFilter))]
public class SampleScript : MonoBehaviour
{
private MDM_Morpher morph;

// Assign target meshes for blend-shape register
public Mesh[] targetMeshes;
public int targetMeshIndex;
 [Range(0, 1)] public float blendValue;

private void Start()
 {
  // Add/Create a Mesh Slime modifier to this object right after start
  morph = MD_ModifierBase.CreateModifier<MDM_Morpher>(gameObject, MD_ModifierBase.MeshReferenceType.CreateNewReference);
  // Assign an array of all the target blend shapes to the morpher
  morph.targetBlendShapes = targetMeshes;
  // Register assigned target blend shapes
  morph.Morpher_RegisterBlendShapes();
 }

private void Update()
 {
  // Pass the script data to the morpher modifier
  morph.targetBlendShapeIndex = targetMeshIndex;
  morph.blendValue = blendValue;
 }
}