An open source mesh slicer framework for Unity3D Game Engine. Written in C#.
An open source mesh slicer framework for Unity3D Game Engine. Written in C#.
Getting started with EzySlice is easy. Below you will find sample usage functions. EzySlice uses extension methods to hide most of the internal complexity.
public GameObject objectToSlice; // non-null
/**
* Example on how to slice a GameObject in world coordinates.
*/
public SlicedHull Slice(Vector3 planeWorldPosition, Vector3 planeWorldDirection) {
return objectToSlice.Slice(planeWorldPosition, planeWorldDirection);
}public GameObject objectToSlice; // non-null
/**
* Example on how to slice a GameObject in world coordinates.
*/
public GameObject[] Slice(Vector3 planeWorldPosition, Vector3 planeWorldDirection) {
return objectToSlice.SliceInstantiate(planeWorldPosition, planeWorldDirection);
}public GameObject objectToSlice; // non-null
/**
* Example on how to slice a GameObject in world coordinates.
* Uses a custom TextureRegion to offset the UV coordinates of the cross-section
*/
public SlicedHull Slice(Vector3 planeWorldPosition, Vector3 planeWorldDirection, TextureRegion region) {
return objectToSlice.Slice(planeWorldPosition, planeWorldDirection, region);
}public GameObject objectToSlice; // non-null
/**
* Example on how to slice a GameObject in world coordinates.
* Uses a custom TextureRegion to offset the UV coordinates of the cross-section
*/
public GameObject[] Slice(Vector3 planeWorldPosition, Vector3 planeWorldDirection, TextureRegion region) {
return objectToSlice.SliceInstantiate(planeWorldPosition, planeWorldDirection, region);
}public GameObject objectToSlice; // non-null
public Material crossSectionMaterial; // non-null
/**
* Example on how to slice a GameObject in world coordinates.
* Uses a custom TextureRegion to offset the UV coordinates of the cross-section
* Uses a custom Material
*/
public SlicedHull Slice(Vector3 planeWorldPosition, Vector3 planeWorldDirection, TextureRegion region) {
return objectToSlice.Slice(planeWorldPosition, planeWorldDirection, region, crossSectionMaterial);
}public GameObject objectToSlice; // non-null
public Material crossSectionMaterial; // non-null
/**
* Example on how to slice a GameObject in world coordinates.
* Uses a custom TextureRegion to offset the UV coordinates of the cross-section
* Uses a custom Material
*/
public GameObject[] Slice(Vector3 planeWorldPosition, Vector3 planeWorldDirection, TextureRegion region) {
return objectToSlice.SliceInstantiate(planeWorldPosition, planeWorldDirection, region, crossSectionMaterial);
}/**
* Example on how to calculate a custom TextureRegion to reference a different part of a texture
*
* px -> The start X Position in Pixel Coordinates
* py -> The start Y Position in Pixel Coordinates
* width -> The width of the texture in Pixel Coordinates
* height -> The height of the texture in Pixel Coordinates
*/
public TextureRegion CalculateCustomRegion(Texture myTexture, int px, int py, int width, int height) {
return myTexture.GetTextureRegion(px, py, width, height);
}/**
* Example on how to calculate a custom TextureRegion to reference a different part of a texture
* This example will use the mainTexture component of a Material
*
* px -> The start X Position in Pixel Coordinates
* py -> The start Y Position in Pixel Coordinates
* width -> The width of the texture in Pixel Coordinates
* height -> The height of the texture in Pixel Coordinates
*/
public TextureRegion CalculateCustomRegion(Material myMaterial, int px, int py, int width, int height) {
return myMaterial.GetTextureRegion(px, py, width, height);
}No open issues yet, or sync has not completed.