Seeking advice on the most effective method for loading multiple models exported from Blender to JSON format.
In the provided example below, I am utilizing the static_objects
array containing predefined object data and model URLs. These URLs are then iterated through in a for loop and passed to the JSONLoader. However, encountering incorrect references when accessing the static_objects
array within the JSONLoader.load
method.
Refer to the example code snippet.
var renderer, camera, scene, controls;
/////// JSOn DATA ////
var static_objects = [
{
name:"ground",
pos:{
x:-45.0, y:-1, z:14.0
},
size:20,
model_url: "obj.moon_ground.json",
},
{
name:"cylinder",
pos:{
x:-20.0, y:0.0, z:0.0
},
size:10,
model_url:"obj.cylinder.json",
}
];
var ObjectsToLoad = static_objects.length || 0;
///////////////////////////
// Remaining JavaScript functions omitted for brevity //
initAll();