> For the complete documentation index, see [llms.txt](https://heroicsolo.gitbook.io/heroic-engine/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://heroicsolo.gitbook.io/heroic-engine/basics/engine-utilities/meshutils.md).

# MeshUtils

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

### Available methods

```csharp
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:*

```csharp
//Slice myself into 2 equal parts, vertically
MeshUtils.Slice(gameObject, Vector3.zero, Vector3.right);
```

<figure><img src="https://1131436974-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9rEHd0nHFvWCSkMEfAjl%2Fuploads%2Farvs6Qx3uoGMWvUZqOuK%2Fimage.png?alt=media&amp;token=869ca20a-33e1-4673-8595-2285baebd599" alt=""><figcaption><p>Mesh was sliced into 2 parts</p></figcaption></figure>

***

```csharp
public static GameObject[] Fracture(GameObject origin, int fragmentsCount, FractureMode fractureMode)
```

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

*Example:*

```csharp
//Fracture gameobject into 6 fragments with different angles of slicing
MeshUtils.Fracture(gameObject, 6, FractureMode.RandomAngles);
```

<figure><img src="https://1131436974-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9rEHd0nHFvWCSkMEfAjl%2Fuploads%2FoFGcbd6Vb3rfdP2x2DaQ%2Fimage.png?alt=media&amp;token=7f07b6bf-3663-4229-a5ac-f69dd8bc94ea" alt=""><figcaption><p>Mesh was fractured into 6 fragments</p></figcaption></figure>

***

```csharp
public static bool GetPlaneIntersectionPoint(Vector3 from, Vector3 to, Vector3 planeOrigin, Vector3 normal, out Vector3 result)
```

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

*Example:*

<pre class="language-csharp"><code class="lang-csharp"><strong>if (MeshUtils.GetPlaneIntersectionPoint(startPoint, 
</strong><strong>    endPoint, planePos, planeNormal, out var foundPoint))
</strong><strong>{
</strong><strong>    Debug.Log($"Intersection found: {foundPoint}");
</strong><strong>}
</strong></code></pre>
