MD Package Technical & APi Documentation
MDM_MeshEffector :: MD_ModifierBase
Namespace: MDPackage.Modifiers
Deform mesh by the specific weight values & sphere-based effector attributes.
Read more here (Online documentation slide)
Public Methods
// Update current mesh state (if Update Every Frame is disabled)
public void Effector_UpdateMesh()
Public Fields and Properties
public EffectorType effectorType = EffectorType.OnePointed; // OnePointed, TwoPointed, ThreePointed, FourPointed

public Transform weightNode0;
public Transform weightNode1;
public Transform weightNode2;
public Transform weightNode3;

[Range(0.0f, 1.0f)] public float weight = 0.5f;
public float weightMultiplier = 1.0f;
public float weightDensity = 3.0f;
[Range(0.0f, 1.0f)] public float weightEffectorA = 0.5f;
[Range(0.0f, 1.0f)] public float weightEffectorB = 0.5f;
[Range(0.0f, 1.0f)] public float weightEffectorC = 0.5f;

public bool clampEffector = false;
public float clampVectorValue = 1.0f;
public float minClamp = -5.0f;
public float maxClamp = 5.0f;
Examples
The following paragraphs contain Mesh Effector modifier component used in a practical example - deform specific mesh with custom node transform.
using UnityEngine;
using MDPackage.Modifiers;

[RequireComponent(typeof(MeshFilter))]
public class SampleScript : MonoBehaviour
{
// Assign custom node for mesh effector
public Transform myNode;

private MDM_MeshEffector effector;

private void Start()
 {
  if (!myNode)
   Debug.LogError("myNode is not assigned!");

  // Add/Create a Mesh Effector modifier to this object right after start
  effector = MD_ModifierBase.CreateModifier<MDM_MeshEffector>(gameObject, MD_ModifierBase.MeshReferenceType.CreateNewReference);
  // Set the effector type, assign node and enable clamping (to avoid mesh clippings and other crazy stuff!)
  effector.effectorType = MDM_MeshEffector.EffectorType.OnePointed;
  effector.weightNode0 = myNode;
  effector.weightMultiplier = -1;
  effector.clampEffector = true;
 }

private void Update()
 {
  // myNode must be assigned
  if (!myNode)
  {
   Debug.LogError("myNode is not assigned!");
   return;
  }

  // Sample extension - if space is pressed, increase the vertex count if possible
  if (Input.GetKeyDown(KeyCode.Space))
   effector.MDModifier_SubdivideMesh();
  // Sample extension - if R is pressed, restore mesh to its original state
  if (Input.GetKeyDown(KeyCode.R))
   effector.MDModifier_RestoreMesh();

  // Sample node position update
  myNode.position = transform.position + new Vector3(Mathf.Sin(Time.time * 0.5f) * 1.5f, 0, Mathf.Cos(Time.time * 0.5f) * 1.5f);
 }
}