I am facing an issue with loading a 3D object that I created in 3D Studio Max! When I export it as a .obj file (which generates two files, .obj and .mtl), I have tried using OBJMTLLOADET(), MTLLOADER(), and OBJLOADER() but none of them seem to work. Other objects load successfully, so I believe the problem lies in how I export the object from 3D Max.
Below are the codes I have used in WebGL to load the object:
var loader = new THREE.OBJLoader();
loader.addEventListener ('load', function(event)
{
objModel = event.content;
objModel.traverse(function(child)
{
if (child instanceof THREE.Mesh)
{
child.material = new THREE.MeshBasicMaterial
({
color:0xffffff, wireframe: true
});
}
});
objModel.position.y -80;
scene.add(objModel);
});
loader.load('asteroid.obj');
Next code:
var loader = new THREE.OBJMTLLoader();
loader.addEventListener ('load', function(event){
objModel = event.content;
objModel.position.x = 80;
objModel.position.y = -80;
objModel.position.z = 0;
objModel.scale.y = 1;
objModel.scale.x = 1;
objModel.scale.z = 1;
scene.add(objModel);
});
loader.load('asteroid.obj','asteroid.mtl');
These codes work perfectly fine with other objects, but not with my specific object! Can someone guide me on how to correctly export an object from 3D Studio Max for use in Three.js?
UPDATE: Here is the link to download the object: Download .obj file