// Refresh & register current mesh state. This will override the backup vertices to the current mesh state publicvoid Bend_RegisterCurrentState() // Bend object by the float value or UI.Slider value publicvoid Bend_BendObject(float entry)
Public Fields
public BendDirection bendDirection = BendDirection.X; // X, Y, Z
privatevoid Start() { // Add/Create a bend modifier to this object right after start bend = MD_ModifierBase.CreateModifier<MDM_Bend>(gameObject, MD_ModifierBase.MeshReferenceType.CreateNewReference); // Update current modifier every frame bend.updateEveryFrame = true; // Otherwise it can be updated manually by calling... // bend.MDModifier_ProcessModifier(); }
privatevoid Update() { // Sample bend processing bend.bendValue = Mathf.Sin(Time.time * 2.0f) * 1.25f; // Sample extension - if space is pressed, increase the vertex count if possible if (Input.GetKeyDown(KeyCode.Space)) bend.MDModifier_SubdivideMesh(); // Sample extension - if R is pressed, restore mesh to its original state if (Input.GetKeyDown(KeyCode.R)) bend.MDModifier_RestoreMesh(); } }