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)
sphere.onBeforeRenderObservable.add(function() {
scene.clipPlane = new BABYLON.Plane(1, 0, 0, 0);
});
sphere.onAfterRenderObservable.add(function() {
scene.clipPlane = null;
});