Available Methods
public void SS_Funct_RestoreOriginal()
Restore mesh to its initial/original state
public void SS_Funct_BakeMesh()
Bake mesh transform and matrix, register the scale to 1:1
public void SS_Funct_DoSculpting(Vector3 WorldPoint, Vector3 Direction, float Radius, float Strength, SS_State_Internal State)
Process sculpting on the current mesh
public void SS_Funct_RefreshMeshCollider()
Refresh the current mesh collider
public void SS_Funct_ChangeBrushState(int StateIndex)
Change brush state = 0 – none, 1 – raise, 2 – lower, 3 – revert, 4 - noise, 5 - stylize, 6 - smooth
public void SS_Funct_SetBasics(float Radius, float Strength, bool showBrush, Vector3 BrushPoint, Vector3 BrushDirection)
Set basic parameters for current sculpting object (Call this if you would like to setup a brand new sculpting editor in real-time. This method contains all the required params for proper sculpting)
public void SS_Funct_ChangeRadius(Slider UI or float)
Change radius of sculpt brush
public void SS_Funct_ChangeStrength(Slider UI or float)
Change strength of sculpt brush
public void SS_Funct_RecordToHistory()
Record current vertex position to the history (if possible)
public void SS_Funct_Undo()
Step back undo (if possible)
Example
using UnityEngine;
using MD_Plugin;
public class Example : MonoBehaviour
{
public MDM_SculptingLite m; // Assign the proper object
public float brushSize = 3;
public float brushIntens = 1;
public Vector3 sculptingDir = Vector3.up; // You can customize your own direction (for example towards another vector [vec1-vec2])
private void Update()
{
// Sculpt with cursor with the left mouse button
if(Input.GetMouseButton(0))
{
// Create main camera instance & ray origin (from cursor)
Ray r = Camera.main.ScreenPointToRay(Input.mousePosition);
if(Physics.Raycast(r, out RaycastHit hit))
{
if(hit.collider && hit.collider.gameObject == m.gameObject)
{
m.SS_Funct_DoSculpting(hit.point, sculptingDir, brushSize, brushIntens, SS_State_Internal.Raise); // Process sculpting with custom params
}
}
}
}
}