When intersectObjects detection is used , internal object was not detected

this is example

https://jsfiddle.net/2o3jq0c6/8/
or

or

I want intersectObject mPart_DZ.
But it’s been obscured by an outer layer transparent object mPart_DJKT1 ,
i can’t pick up this object mPart_DZ .

if(!event.clientX && !event.touches){  resolve({status:false, intersectObj:null})}
						const clientX = event.clientX || event.touches[ 0 ].clientX;
						const clientY = event.clientY || event.touches[ 0 ].clientY;

						this.pointer.x = ( clientX / window.innerWidth ) * 2 - 1;
						this.pointer.y = - ( clientY / window.innerHeight ) * 2 + 1;

						this.raycaster.setFromCamera( this.pointer, this.camera );

						const intersects = this.raycaster.intersectObjects( this.modelNodeList, true);

						// intersects.forEach((item:any)=>{
						//     if(item.object.name === 'mPart_DZ') {
						//         alert(1);
						//     }
						//     console.log(item.object.name);
						// })

						if ( intersects.length <= 0 ) {
							resolve({status:false, intersectObj:null})
						}else {
							const intersectObj = intersects[ 0 ].object;
							resolve({status:true, intersectObj:intersectObj});
						}

Don’t forget to apply the second parameter to indicate a recursive test. You have to set it to true.

I’ve set it true,but it’s still not detected ,
So I feel weird.

Please don’t create new topic for the same question. The duplicate will be deleted.

ok, I reedited the question for this post

1 Like

You can control which objects should be rendered and part of intersections test via layers. Just move the object you want to exclude from the intersection test to layer 1 and let the instance of raycaster use the default layer 0. https://jsfiddle.net/v25xp1mL/1/

1 Like

I need traverse the hidden object and all of its children’s layers ,
make their layers inconsistent with the camera’s layers.

https://jsfiddle.net/eL689k74/23/

This will solve my problem .
Thank you very much .