As I dive deeper into learning three.js, I've encountered a stumbling block that has halted my progress.
Despite spending days scouring for solutions, I have not been able to find a suitable answer to my dilemma.
The issue pertains to the inability to import materials of a JSON model. The error message "Cannot read property 'length' of undefined" keeps popping up, leaving me perplexed.
The code snippet I'm using for importing is quite straightforward:
var loader = new THREE.ObjectLoader();
loader.load( "island.json", function ( geometry, materials ) {
mesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial( materials ) );
scene.add( mesh );
render();
} );
The JSON file I'm attempting to import is extensive, so I created a smaller sample which encounters the same error. You can view it here.
I am hopeful that someone can provide assistance!
Thank you in advance!