Hi All,
I have a glb object and When I try to clip it with a plane I get this shape :
I need to change the position of the plane and I want to clip the object as a group with color.
My code
let Objobject = gltf.scene;
const params = {
clipIntersection: false,
planeConstant: 0,
showHelpers: true
};
let plane = new Plane( new Vector3( 0, 0, measuresZG.min + wallWidth + 0.1 ), 0.1 );
// Here I tried to change the position of the plane but not worked.
// plane.position.z = measuresZG.min ;
let clipPlanes = [
plane
];
const group = new Group();
gltf.scene.traverse( function ( child ) {
if ( child.isMesh ) {
const geometry = child.geometry;
const material = new MeshLambertMaterial( {
side: DoubleSide,
clippingPlanes: clipPlanes,
clipIntersection: params.clipIntersection,
map:child.material.map
} );
let mesh = new Mesh( geometry, material );
mesh.position.x = child.position.x;
mesh.position.y = child.position.y;
mesh.position.z = child.position.z;
mesh.rotation._y = child.rotation._y;
group.add( mesh );
}else{
child.traverse( function ( child2 ) {
if ( child2.isMesh ) {
const geometry = child2.geometry;
const material = new MeshLambertMaterial( {
side: DoubleSide,
clippingPlanes: clipPlanes,
map:child2.material.map,
clipIntersection: params.clipIntersection
} );
let mesh = new Mesh( geometry, material );
mesh.position.x = child2.position.x;
mesh.position.y = child2.position.y;
mesh.position.z = child2.position.z;
mesh.rotation._y = child2.rotation._y;
group.add( mesh );
}});
}
} );
scene.add( group );