Material clipPlane not moving with mesh (see PG link)

Hi! I am attempting to create a mesh by applying clipping planes to a box. I must use planes to clip the box since I was given plane parameters in my source data. Here’s the code I use:

    var box = BABYLON.MeshBuilder.CreateBox("box", scene);
    const mat = new BABYLON.StandardMaterial("mat", scene);
    mat.clipPlane = new BABYLON.Plane(-0.4472, 0.8944, 0.0000, -0.2236);
    box.material = mat;

But there are two problems. The clipping plane removes the top of the mesh from rendering (I naively assumed that the box would be a solid), and if I move the mesh the clipping plane doesn’t move.

Is there a better way to produce my desired mesh using the plane provided above ?

Welcome aboard!

I think what you want to do is using CSG to generate a capped box?

1 Like