Available Methods
public void SPR_OnProcessSculpting()
Process sculpting by specified settings in the inspector (This is the general method to process sculpting - required while using custom sculpting feature)
public void SPR_OnStopSculpting()
Stop sculpting (used mostly on 'MouseUp' event) - refreshes mesh collider and sets all the other required parameters (required while using custom sculpting feature)
public void SPR_OnEnableDisableSculpting()
Enable or Disable sculpting and script in general (safer way - don't use 'enabled = value')
public void SPR_OnCustomSculpting(PARAMETERS)
Do custom sculpting by specified settings in the method brackets; this method allows you to detaily specify custom sculpting point, intensity and feature
public void SPR_ChangeRadius(float or UI.Slider value)
Change sculpting radius by the custom value
public void SPR_ChangeIntensity(float or UI.Slider value)
Change sculpting intensity by the custom value
public void SPR_ChangeBrushState(int state)
Change sculpting brush state by the existing option [None = 0, Raise = 1, Lower = 2, Revert = 3, Grab = 4, Noise = 5, Smooth = 6, Stylize = 7]
public void SPR_ChangeSculptingType(int sculptingType)
Change sculpting type by the existing option [VertexNormal = 0, VertexDirection = 1, SurfaceNormal = 2, CustomDirection = 3, CustomObjectForwardDirection = 4]
public void SPR_ChangeNoiseDirection(int directionType)
Change noise direction by the existing option [XYZ = 0, XZ = 1, XY = 2, YZ = 3, Z = 4, Y = 5, X = 6, Centrical = 7, VertexNormal = 8]
public void SPR_ChangeSmoothingType(int smoothingType)
Change smoothing type by the existing option [LaplacianFilter = 0, HCFilter = 1]
public void SPR_ChangeRadiusType(int radiusType)
Change radius type by the existing option [Expontential = 0, Linear = 1]
public void SPR_EnableDisableDistanceLimit(bool activationValue)
Enable/Disable distance limitation feature by the custom boolean value
public void SPR_ChangeDistanceLimit(float or UI.Slider value)
Change distance limitation by the custom value
public void SPR_OnUndo()
Process undo action (if possible)
public void SPR_OnRestoreTarget()
Restore locked target to its original/ initial mesh data
public void SPR_SubdivideTarget()
Process a subdivision on a locked target model
public void SPR_SmoothTarget()
Process a smooth function on a locked target model
public void SPR_FlipTarget()
Process a flip function on a locked target model
public void SPR_TryCloseSeamsTarget(float distanceApproach)
Try to close broken seams on a locked target model (the value in the brackets tells the script what can be the maximum distance of vertices on the similar position)
public void SPR_TryAutoCloseSeamsTarget(bool trueFalse)
Process sculpting by specified settings in the inspector (This is the general method to process sculpting - required while using custom sculpting feature)
Example
using UnityEngine;
using SculptingPro;
// Example script for custom sculpting - process your own sculpting method with multiple purposes
// Create even a multi-symmetrical sculpting (The script below does not demonstrate the symmetrical sculpting)
public class ExampleCustomSculpting : MonoBehaviour
{
public SculptingPro_Model targetModel; // Assign the proper object - this is your target for sculpting
public Camera mainCam; // Assign the proper object
public SculptingPro_Realtime realtimeSculpting; // Assign the proper object
public bool lowerBrush = false; // If false, the brush will be raising the mesh
public float customRadius = 1.0f;
public float customIntensity = 0.1f;
private bool doingSculpting = false;
private void Update()
{
Ray r = mainCam.ScreenPointToRay(Input.mousePosition);
// The sculpting method itself
if (Physics.Raycast(r, out RaycastHit hit, Mathf.Infinity))
{
if (hit.collider)
{
// Customize inner parameters for the final custom sculpting method
realtimeSculpting.SPR_OnCustomSculpting(targetModel, hit.point, Vector3.up, !lowerBrush, customRadius, customIntensity);
doingSculpting = true;
}
else ReleaseSculpting();
}
else ReleaseSculpting();
}
// Called if the sculpting process is stopped (this method is REQUIRED)
private void ReleaseSculpting()
{
// Return if no sculpting is processed
if (!doingSculpting) return;
// Required method to call when the sculpting ends!
realtimeSculpting.SPR_OnStopSculpting();
doingSculpting = false;
}
}