Currently I am having a problem with assigning name to mesh object before loading it. I have the code as below, and the object’s name (as well as position) always take the value of the last model in the array.
Do you have any idea how to solve it? Thank you :)
for (var model in scenario_models)
{
var id = model.id;
var loader = new THREE.OBJMTLLoader();
loader.load('/static/models/building_models/ZehYO2qAzU7wm6HfCeIVJC62EQQqW0wv8h4pa0TzhAtSm9qoL6/male02.obj',
'/static/models/building_models/ZehYO2qAzU7wm6HfCeIVJC62EQQqW0wv8h4pa0TzhAtSm9qoL6/male02.mtl',
function ( object )
{
object.name = model.id;
object.position.x = model.x;
object.position.y = model.y;
object.position.z = model.z;
scene.add( object );
});
}