privatevoid 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.MbUpdateEveryFrame = true; // Otherwise it can be updated manually by calling... // twist.MDModifier_ProcessModifier(); }
privatevoid 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(); } }