// Refresh & register current mesh state. This will override the backup vertices to the current mesh state publicvoid Twist_RegisterCurrentState() // Twist object by float value or UI.Slider value publicvoid Twist_TwistObject(float entry)
Public Fields
publicTwistDirection twistDimension = TwistDirection.X; // X, Y, Z publicTwistDirection twistDirection = TwistDirection.X;
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.updateEveryFrame = 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(); } }