I’ve imported an .obj model in my scene, but I can’t get any other attributes such as mesh, materials, etc from it. I want to do some collision detection and ray casting, but they all seem to work with meshes (I’ve tested with a box mesh), and nothing happened when I tried to apply them to the model. So my questions are: what is the type of object of the imported models? And if it’s some kind of general object, can we turn it to object3D
or some other three.js objects type without distording it in the scene? Thanks a lot
Here is the loading code:
var mtlLoader = new THREE.MTLLoader();
mtlLoader.setResourcePath('/models/');
mtlLoader.setPath('/models/');
mtlLoader.load('/3dbaotang.mtl', (materials) => {
materials.preload();
var objLoader = new THREE.OBJLoader();
console.log(typeof objLoader);
objLoader.setMaterials(materials);
objLoader.setPath('/models/');
objLoader.load('3dbaotang.obj', (object) => {
object.castShadow = true;
object.receiveShadow = true;
object.position.y = 70;
scene.add(object); // <-- what type is this object?
});
});