# \[Solved\] Cut mesh using plane

**URL:** <https://forum.babylonjs.com/t/solved-cut-mesh-using-plane/24751>\
**Category:** Questions\
**Created:** [October 21, 2021, 1:54pm UTC](https://forum.babylonjs.com/t/solved-cut-mesh-using-plane/24751 "2021-10-21T13:54:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Todilo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/todilo/32/19084_2.png) [@Todilo](https://forum.babylonjs.com/u/Todilo)\
**Post date:** [October 21, 2021, 1:54pm UTC](https://forum.babylonjs.com/t/solved-cut-mesh-using-plane/24751/1 "2021-10-21T13:54:34Z")

</div>

I was wondering if it is possible to cut a mesh using a plane (I have position and normal). I have tried clipPlane and it works great, except it is for the whole scene.

Also looked into CSG but I need to make some volume for that? Worst come to worst I can create my own cuting function but was hoping for something built in.

Btw, this framework is awesome!

Edit: Embarassing but I found it in the docs.  
For anyone else that comes here:  
onBeforeRender set to your cutting plane (sphere is the mesh in this case but if you import using SceneLoader.ImportMesh you might need to cast `(yourMesh as Mesh).onBeforeRenderObserveable)`.

Then onAfterRenderObservable you restore the clip plane (in this case null)

```auto
sphere.onBeforeRenderObservable.add(function() {
    scene.clipPlane = new BABYLON.Plane(1, 0, 0, 0);
});

sphere.onAfterRenderObservable.add(function() {
    scene.clipPlane = null;
});

```

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [October 21, 2021, 2:19pm UTC](https://forum.babylonjs.com/t/solved-cut-mesh-using-plane/24751/2 "2021-10-21T14:19:04Z")

</div>

Not embarrasing at all 🙂 and thanks a lot for sharing your findings!

---

<div class="post-metadata">

**Author:** ![PirateJC](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/piratejc/32/1003_2.png) [@PirateJC](https://forum.babylonjs.com/u/PirateJC)\
**Post date:** [October 22, 2021, 12:06am UTC](https://forum.babylonjs.com/t/solved-cut-mesh-using-plane/24751/3 "2021-10-22T00:06:02Z")

</div>

> [@Todilo](#):
>
> For anyone else that comes here:

Can I just say a HUGE thank you!

The fact that you asked a question, then came back and helped teach future people what you’ve learned. That is so epically awesome! Thank you for giving back to this community!

You rock!
