I’ve been looking into cut planes, and so far so good with the basics. However, I’ve got a bit stuck on trying to add an x + y rotation combined with a z translation with a visible plane.
The translations of the cut plane work great, but it looks like during my translation I need to scale the d value - in my current example whenever I apply an x and y rotation, the visible plane has an unwanted offset. I’m not sure how to remove the visible offset and I’m guessing it’s a scaling issue. I’m not sure how to remove it.
The above example is brilliant, but I’ve managed to get stuck again.
Is there a way to rotate the cut plane at its translated position? At the moment, like in the above example, when you translate along the z, the rotation point remains to be at the scene.clipPlane3.normal vector. I’d like to move the rotation point to where the cut plane has been translated to. So that the rotation pivots about the visible plane?
Thanks again for all your help, any guidance would be greatly appreciated
First off, I just wanted to say a huge thanks to @Evgeni_Popov and @sebavan. You’ve always gone above and beyond to show me the way. It’s a learning curve, but a good one!
I’ve finally managed to pick the above back up to see if I can further my understanding (I thought I had the maths but failed). I’ve been experimenting with the above to see how to implement cut sections with models that are off-centred in world space. Similar to the question above, but the model position is (50, 100, 1000) instead of (0,0,0).
I’ve made some progress. I’ve managed to get the Z translation and X rotation to mostly work (apart from the visible plane flipping/spinning behaviour).
The block I’ve run into is how to get the Y rotation to work with the new model coordinate. I’m guessing I’ve taken the wrong approach, and at this point, my brain keeps going round in circles.
Sorry, I’ve got yet another follow up question. Following your direction from before, is it possible in Babylon to apply the rotation transformation of the clip plane in local space relative to the plane position? Rather than global/world space?
i.e. similar behaviour to doing plane.translate(BABYLON.Axis.X, 2, BABYLON.Space.LOCAL); but with the clipplane too?
The use-case (when using this playground) is when the red slider is halfway, using the green slider makes the plane just spin (due to the global Transform). I’m a bit stuck in finding a way to rotate the plane from the local normal.
Thanks again for any guidance/help you might be able to give
I’ve created a rough playground here. Hopefully, it shows better what I mean. It manipulates the visible plane with the desired effect I’m trying to achieve with the clip plane. It transforms the local vector of the visible plane. But I’m not sure how to do the same local transform with the clip plane?
If you can do what you want with a regular 3D plane, just convert this 3D plane to a Plane object: you just need to compute the normal and the d factor of the plane equation: