Namespace: MDPackage.Modifiers
Blend mesh between list of stored & captured shapes.
Read more here (Online documentation slide)
Public Methods
public void Morpher_UpdateMesh()
public void Morpher_ChangeMeshIndex(int entry)
public void Morpher_SetBlendValue(float entry)
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;
public Mesh[] targetMeshes;
public int targetMeshIndex;
[Range(0, 1)] public float blendValue;
private void Start()
{
morph = MD_ModifierBase.CreateModifier<MDM_Morpher>(gameObject, MD_ModifierBase.MeshReferenceType.CreateNewReference);
morph.targetBlendShapes = targetMeshes;
morph.Morpher_RegisterBlendShapes();
}
private void Update()
{
morph.targetBlendShapeIndex = targetMeshIndex;
morph.blendValue = blendValue;
}
}