I build a scene and added multiple gltf models. Three.js detects a SkinnedMesh only rarely when it is in front of a BufferGeometry, even though it always detects the SkinnedMesh when the BufferGeometry is not added to the scene. In front of a PlaneGeometry the SkinnedMesh becomes detected. When BufferGeometry and SkinnedMesh are added to the scene, they are both contained in scene.children and become returned with intersects[ 0 ].object.name. Most times when intersecting the SkinnedMesh, the BufferGeometry in behind becomes returned. This also accounts for raycaster.intersectObjects( scene.children ). This are my relevant lines of code:
raycaster.setFromCamera( mouse, camera );
const intersects = raycaster.intersectObjects( scene.children, true );
for ( let i = 0; i < intersects.length; i ++ )
{
if(intersects[ 0 ].object.name === "Corgi")
{
console.log('corgi');
}
}
What do I need to do to detect the SkinnedMesh? I tried with three.js version r126 and r134.
I appreciate help A LOT! THANKS!