How can we retrieve the name of an object model that was defined during loading from the array returned by the intersectObjects function? The code snippet below is currently returning undefined.
var objLoader = new THREE.OBJLoader();
objLoader.setPath('obj/');
objLoader.load('deadpool.obj', function(object){
objModel = object;
objModel.name = 'ObjectModel3D';
modelHasLoaded = true;
scene.add(objModel);
});
window.addEventListener('mousemove', function(eventTarget){
var intersects = checkIntersection(eventTarget);
if(intersects.length){
console.log(intersects[0].name);
}
}, false);