I am currently working on an extension object clipping with 6 planes. The constant of the plane is being controlled by 3 scroll bars, which can be seen below:
[ https://i.sstatic.net/eHFho.png
The original clippingPlanes are as follows:
var localPlane_x = new THREE.Plane( new THREE.Vector3( -1, 0, 0 ), 5000 );
var localPlane_y = new THREE.Plane( new THREE.Vector3( 0, -1, 0 ), 5000 );
var localPlane_z = new THREE.Plane( new THREE.Vector3( 0, 0, -1 ), 5000 );
var localPlane_x1 = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), 5000 );
var localPlane_y1 = new THREE.Plane( new THREE.Vector3( 0, 1, 0 ), 5000 );
var localPlane_z1 = new THREE.Plane( new THREE.Vector3( 0, 0, 1 ), 5000 );
mesh.material.clippingPlanes = [localPlane_x, localPlane_y, localPlane_z, localPlane_x1, localPlane_y1, localPlane_z1];
When the values change, I update the clippingPlanes
as follows:
mesh.material.clippingPlanes[0].constant = clip1.x + mesh.position.x;
- for the normal
var normal = new THREE.Vector3();
normal.set(-1, 0, 0).applyQuaternion(selected_Object.quaternion);
mesh.material.clippingPlanes[0].normal.copy(normal);
Everything works well when the object is translated or rotated.
https://i.sstatic.net/3iBmU.png
However, things do not work as expected when both rotation and translation are applied.