Accessing world coordinates of models loaded into spoke scene #2939
-
Hi, are there any examples of accessing a spoke model's world coordinates in the Hubs source? Or is there a way to give models that are loaded into a spoke scene their own UID - that can later be filtered for? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hey @11, Hubs uses Aframe which is based on top of Three.js. You can access any object in the scene graph by traversing the scene, or by using one of the built in methods like Object3D.getObjectByName(). So if you name one of your objects in your Spoke scene One thing to note is that some objects are combined when you export. If models share the same material, shadow properties, etc. they could be combined. Non-model elements are not currently combined. Another way to identify an object or add additional data to an object would be to add a new glTF extension to an object on export, but this requires some additional modifications to Spoke and Hubs and it would take some effort. If you're interested in going this route, let me know. I may have to write up a guide. |
Beta Was this translation helpful? Give feedback.
Hey @11, Hubs uses Aframe which is based on top of Three.js. You can access any object in the scene graph by traversing the scene, or by using one of the built in methods like Object3D.getObjectByName(). So if you name one of your objects in your Spoke scene
Model12345
, you can then callAFRAME.scenes[0].object3D.getObjectByName("Model12345")
and it will return the Object3D representing that object.One thing to note is that some objects are combined when you export. If models share the same material, shadow properties, etc. they could be combined. Non-model elements are not currently combined.
Another way to identify an object or add additional data to an object would be to add a new glT…