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)
Properties
// Smoothly interpolate between shapes?
public bool EnableInterpolation { get; set; }
public float InterpolationSpeed { get; set; }

// Value 0-1
public float BlendValue { get; set; }

// Target raw blend shapes/ meshes
public Mesh[] TargetBlendShapes { get; set; }
public int TargetBlendShapeIndex { get; set; }

// Reset vertices when the state (index above) has been changed
public bool ResetVertexStateOnChange { get; set; }

// Registered blend shapes/ meshes
public IReadOnlyCollection<RegisteredBlendShapes> CurrentRegisteredBlendShapes { get; }
Public Methods
// Update current mesh state
public void Morpher_UpdateMesh()
// Change current target morph mesh index
public void Morpher_ChangeMeshIndex(int entry)
// Register assigned blend shapes and create unique list of vertices ready for blending
public void Morpher_RegisterBlendShapes()
Examples
The following paragraphs contain Morpher modifier used in a practical example. Register specific morph shapes and control blending via script.
using UnityEngine;
using MDPackage.Modifiers;

[RequireComponent(typeof(MeshFilter))]
public class SampleScript : MonoBehaviour
{
// Assign target meshes for blend-shape register
 [SerializeField] private Mesh[] targetMeshes;
 [SerializeField] private int targetMeshIndex;
 [SerializeField, Range(0f, 1f)] private float blendValue;

private MDM_Morpher morph;

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;
 }
}