I am facing an issue with loading a .obj model in Three.js. I created the model in Cinema 4D, exported it with a scale of 1 meter, and tried to load it using OBJLoader in Three.js. However, even though there are no errors, the model is not showing up. What could be causing this problem?
<script src="http://threejs.org/build/three.js"></script>
<script src="http://threejs.org/examples/js/loaders/OBJLoader.js"></script>
<body style="margin:0;padding:0;">
</body>
<script>
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(45, innerWidth / innerHeight, 1, 2000);
var render = new THREE.WebGLRenderer();
camera.position.set(0, 0, 53);
render.setSize(innerWidth, innerHeight);
document.body.appendChild(canvas = render.domElement);
render.setClearColor(0x111111, 1);
function loadScene() {
var loader = new THREE.OBJLoader();
loader.load("./fox.obj", function(model) {
model.traverse(function(child) {
if (child instanceof THREE.Mesh) {
child.material.color = 0xffb830;
}
});
model.position.set(0, 0, -53);
scene.add(model);
window.model = model;
});
render.render(scene, camera);
}
window.onload = loadScene;
</script>