MD Package Technical & APi Documentation
MDM_Twist :: MD_ModifierBase
Namespace: MDPackage.Modifiers
Twist mesh by the specific value to the specific direction.
Read more here (Online documentation slide)
Public Methods
// Refresh & register current mesh state. This will override the backup vertices to the current mesh state
public void Twist_RegisterCurrentState()
// Twist object by float value or UI.Slider value
public void Twist_TwistObject(float entry)
Public Fields
public TwistDirection twistDimension = TwistDirection.X; // X, Y, Z
public TwistDirection twistDirection = TwistDirection.X;

public float twistValue = 0;
public bool twistMirrored = true;
Examples
The following paragraphs contain Twist modifier used in a practical example.
using UnityEngine;
using MDPackage.Modifiers;

[RequireComponent(typeof(MeshFilter))]
public class SampleScript : MonoBehaviour
{
private MDM_Twist twist;

private void Start()
 {
  // Add/Create a twist modifier to this object right after start
  twist = MD_ModifierBase.CreateModifier<MDM_Twist>(gameObject, MD_ModifierBase.MeshReferenceType.CreateNewReference);
  // or just:
  //twist = gameObject.AddComponent<MDM_Twist>();

  // Update current modifier every frame
  twist.updateEveryFrame = true;
  // Otherwise it can be updated manually by calling...
  // twist.MDModifier_ProcessModifier();
 }

private void Update()
 {
  // Sample twist processing
  twist.twistValue = Mathf.Sin(Time.time * 2.0f) * 2.25f;
  // Sample extension - if space is pressed, increase the vertex count if possible
  if (Input.GetKeyDown(KeyCode.Space))
   twist.MDModifier_SubdivideMesh();
  // Sample extension - if R is pressed, restore mesh to its original state
  if (Input.GetKeyDown(KeyCode.R))
   twist.MDModifier_RestoreMesh();
 }
}