I am trying to determine if my raycaster is looking at a loaded OBJ. The OBJ seems to be a THREE.Group with 3 children, not a THREE.Object as expected from Cinema4D exports. Can I modify the raycaster code to target this group instead of an object?
raycaster.set(controls.getObject().position, controls.getDirection(), 0, 40)
var intersects = raycaster.intersectObjects(scene.children, true);
if (intersects.length > 0) {
//DETECTING AN INTERSECTION
for (var i = 0; i < onOffCubes.length; i++) {
//Check if the first intersection is with one of my cubes
if (intersects[0].object == onOffCubes[i]) {
ExperiencesData[i].userClose = true
}
}
}
The array onOffCubes contains 6 OBJs/THREE.js Groups:
https://i.sstatic.net/MwAcr.png
When console.log(onOffCubes[0]) is executed, it returns: https://i.sstatic.net/tlhk0.png