Namespace: MDPackage.Modifiers
Deform mesh by the specific weight values & spherical effectors.
Read more here (Online documentation slide)
Properties
public bool ThreadUseMultithreading { get; set; }
public bool ThreadEditorThreadSupported { get; }
public bool ThreadIsDone { get; }
public int ThreadSleep { get; set; }
public bool UseGameObjectsAsWeights { get; set; }
public EffectorType CurrentEffectorType { get; set; }
public Vector3 WeightNodeA { get; set; }
public Vector3 WeightNodeB { get; set; }
public Vector3 WeightNodeC { get; set; }
public Vector3 WeightNodeD { get; set; }
public Transform WeightNodeATransform { get; set; }
public Transform WeightNodeBTransform { get; set; }
public Transform WeightNodeCTransform { get; set; }
public Transform WeightNodeDTransform { get; set; }
public float Weight { get; set; }
public float WeightMultiplier { get; set; }
public float WeightDensity { get; set; }
public float WeightEffectorAB { get; set; }
public float WeightEffectorBC { get; set; }
public float WeightEffectorCD { get; set; }
public bool ClampEffector { get; set; }
public float ClampVectorValue { get; set; }
public float ClampMin { get; set; }
public float ClampMax { get; set; }
Public Methods
public void Effector_UpdateMesh()
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
{
[SerializeField] private Transform myNode;
private MDM_MeshEffector effector;
private void Start()
{
if (!myNode)
Debug.LogError("myNode is not assigned!");
effector = MD_ModifierBase.CreateModifier<MDM_MeshEffector>(gameObject, MD_ModifierBase.MeshReferenceType.CreateNewReference);
effector.MbUpdateEveryFrame = true;
effector.CurrentEffectorType = MDM_MeshEffector.EffectorType.OnePointed;
effector.UseGameObjectsAsWeights = true;
effector.WeightNodeATransform = myNode;
effector.WeightMultiplier = -1;
effector.ClampEffector = true;
}
private void Update()
{
if (!myNode)
{
Debug.LogError("myNode is not assigned!");
return;
}
if (Input.GetKeyDown(KeyCode.Space))
effector.MDModifier_SubdivideMesh();
if (Input.GetKeyDown(KeyCode.R))
effector.MDModifier_RestoreMesh();
myNode.position = transform.position + new Vector3(Mathf.Sin(Time.time * 0.5f) * 1.5f, 0, Mathf.Cos(Time.time * 0.5f) * 1.5f);
}
}