Hi,
I’m clipping my objects with material clipping. I’m also selecting objects with a mouse.
Now, what is the cleanest way to prevent picking with the mouse where the material is being clipped?
I’m using this for material clipping:
var clipPlane = new THREE.Plane();
clipPlane.setFromCoplanarPoints(
new THREE.Vector3(...),
new THREE.Vector3(...),
new THREE.Vector3(...)
);
var object = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: 0xffffff, clippingPlanes: [clipPlane]} ) );
And this for mouse picking:
// set raycaster ray to mouse and camera
raycaster.setFromCamera( editorMouse, editorCamera );
// detect intersects
var intersects = raycaster.intersectObjects( editorScene.children, true);
if ( intersects.length > 0 )
{
if ( INTERSECTED != intersects[0].object )
{
if ( INTERSECTED ) INTERSECTED.material.emissive.setHex( INTERSECTED.currentHex );
INTERSECTED = intersects[0].object;
INTERSECTED.currentHex = INTERSECTED.material.emissive.getHex();
INTERSECTED.material.emissive.setHex( 0xff0000 );
}
}
else
{
if ( INTERSECTED ) INTERSECTED.material.emissive.setHex( INTERSECTED.currentHex );
INTERSECTED = null;
}
Help well appreciated!
Thanks.