If I use raycaster in this way to detect the intersection of the mouse with a cube it works just fine !
raycaster.setFromCamera(mouse, camera)
const intersects = raycaster.intersectObject(cubeMesh)
if(intersects.length > 0)
console.log('intersecting')
and after this I have a .gltf object which is positioned exactly as the cubeMesh
and I do check if it is loaded first and all this is taking place in an “update” function (every frame) but the interseciton with the .gltf is not detected:
const Update = () => {
renderer.render(scene, camera)
raycaster.setFromCamera(mouse, camera)
if(gltfObj){
const intersects = raycaster.intersectObject(gltfObj)
if(intersects.length > 0)
console.log('intersecting')
}
requestAnimationFrame(Update);
};