Can someone assist me with loading an object file from my local browser in Threejs ( Rev 71)? I keep encountering an error that says loadModel.html:1 Uncaught SyntaxError: Unexpected token #.
Even after trying to load the object file using chrome --allow-file-access-from-files, I still end up with a blank page and the same error. I'm curious to know where I might have gone wrong in this seemingly simple script.
<!DOCTYPE html>
<html lang="en">
<head>
<title> Load Model</title>
<meta charset="utf-8">
</head>
<body style="margin: 0;">
<script src="three.js"></script>
<script src="ObjectLoader.js"></script>
<script>
var scene, camera, renderer;
init();
animate();
function init()
{
scene = new THREE.Scene()
var WIDTH = window.innerWidth,
HEIGHT = window.innderHeight;
//Created camera
camera = new THREE.PerspectiveCamera(45, WIDTH/HEIGHT, 0.1, 2000);
camera.position.set(0,0, 100);
scene.add(camera);
var ambientLight = new THREE.AmbientLight(0xffffff);
scene.add(ambientLight);
var loader = new THREE.ObjectLoader();
loader.load( 'obj/Male.obj', function (object) {
scene.add( object );
});
renderer = new THREE.WebGLRenderer({antialias:true});
renderer.setSize(WIDTH, HEIGHT);
document.body.appendChild(renderer.domElement);
}
function animate()
{
requestAnimationFrame(animate);
renderer.render(scene, camera);
}
</script>
</body>
</html>