MeshUtils

This class provides useful helper methods for 3D meshes. For example, you can easily slice your mesh into 2 parts!

Available methods

public static GameObject[] Slice(GameObject origin, Vector3 cutOrigin, Vector3 cutNormal)

This method slices given mesh into 2 parts, saving all physical characteristics and collider (if was presented on original gameobject).

cutOrigin is point where slice plane should pass (in local object's space, so Vector3.zero will be the center of object).

Example:

//Slice myself into 2 equal parts, vertically
MeshUtils.Slice(gameObject, Vector3.zero, Vector3.right);
Mesh was sliced into 2 parts

This method fractures given object into certain count of fragments, with certain fracture mode.

Example:

Mesh was fractured into 6 fragments

This method finds intersection point between given vector (set by from and to positions) and plane.

Example:

Last updated