When 3D object is loaded during runtime in Aframe, how to access the mesh information?
I have loaded the 3D Model with:
targetObj = document.createElement('a-obj-model');
targetObj.setAttribute('gltf-model', '#whatever_model');
and the following is how I tried to get the mesh information:
targetObj.addEventListener('loaded', function () {
console.log(targetObj.hasLoaded);
console.log(targetObj.getObject3D('mesh'));
});
When I do this, I see the targetObj
is loaded, however, the mesh information is undefined
.
(or model-loaded event):
targetObj.addEventListener('object3dset', function (evt) {
if (evt.detail.name !== 'mesh') { return; }
targetObj.getObject3D('mesh');
});