I have been trying to load a JSON image in Three.js by following a tutorial video. However, despite copying the code exactly as shown in the video, I am not able to see anything in the browser when using my own images. The JSON file is downloaded from clara.io.
Below is the relevant code snippet from my JavaScript file that I have implemented:
<script src="js/ObjectLoader.js"></script>
<script>
var loader = new THREE.ObjectLoader();
loader.load
(
'models/standard-male-figure.json',
function(object)
{
scene.add(object);
}
);
camera.position.z = 3;
</script>
The console displays some errors which makes me suspect that the video tutorial might be outdated. However, I am unsure how to address these issues. Here are the error messages:
Uncaught SyntaxError: Unexpected token {
three.js:22676 THREE.WebGLRenderer 104
three.js:38584 THREE.ObjectLoader: You have to import LegacyJSONLoader in order load geometry data of type "Geometry".
three.js:38598 Uncaught TypeError: Cannot set property 'uuid' of undefined
at ObjectLoader.parseGeometries (three.js:38598)
at ObjectLoader.parse (three.js:38274)
at Object.onLoad (three.js:38244)
at XMLHttpRequest.<anonymous> (three.js:34554)