A Unity plugin that enables real-time mesh slicing of 3D objects. This tool allows you to dynamically cut 3D meshes along arbitrary planes while maintaining mesh integrity, UV mapping, and proper face generation.
- Real-time mesh slicing along any plane
- Maintains UV mapping and texture coordinates
- Generates proper mesh faces at cut surfaces
- Supports normal interpolation for smooth transitions
- Automatic triangulation of cut faces
- Translation animation for sliced parts
- Area calculation for slice validation
- Local to world space conversion handling
The slicer works by:
- Detecting intersection points between the slice plane and mesh triangles
- Splitting affected triangles and creating new vertices
- Generating new UV coordinates through interpolation
- Creating proper faces for the cut surface
- Maintaining mesh normals for correct lighting
- Separating the mesh into two distinct parts
- Clone this repository or download the latest release
- Import the package into your Unity project
- Attach the
SliceMe
script to any mesh you want to make sliceable - Configure the slicing parameters in the inspector
// To make an object sliceable
[RequireComponent(typeof(MeshFilter))]
public class SliceMe : MonoBehaviour
{
// Configure in inspector
public float translaitonSpeed;
public float translationDistance;
}
// To perform a slice
public void Slice(SlicerPlane slicePlane)
{
// Create slice plane and execute cut
SlicerPlane plane = new SlicerPlane();
yourSliceableObject.Slice(plane);
}
The SliceMe
component exposes the following properties:
CreateslicePart
: Toggle slice part creationtranslaitonSpeed
: Speed at which sliced parts movetranslationDistance
: Distance sliced parts travel
- Unity 2019.4 or higher
- Mesh objects must have proper UV mapping
- Objects must have MeshFilter component
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
This project is licensed under the MIT License - see the LICENSE file for details