Reputation: 373
I am working with a gltf model for a game. It is referenced as -
<a-asset-item id="orca1" src="../images/models/orca/scene.gltf"></a-asset-item>
and then accessed as
<a-entity id="orca" position="-1 0.4 -40" gltf-model="#orca1"></a-entity>
and
<a-entity model-subset="target: #orca"></a-entity>
So, in the model-subset component, I am trying to get a hold on the object3d scene so that I can clone it. Here is how I access the object3d there
AFRAME.registerComponent('model-subset', {
schema: {
target: { default: '', type: 'selector' }
},
init: function() {
var data = this.data;
var el = this.el;
console.log(data.target.object3D.children);
data.target.addEventListener('model-loaded', function(e) {
this.model = e.detail.model;
console.log(this.model)
})
}
})
What I am trying to understand is - when I do the data.target.object3D.children, I get the following in my console log -
but the e.detail.model gives the following in the console log -
So, when I try to access the "OSG_Scene" from data.target.object3d.children[0], I get "undefined" in the console.log.
Also, why am I not able to get "OSG_Scene" via either of these methods -
Thank you so much for your help.
Upvotes: 1
Views: 1388