It would be helpful to be able to translate and rotate content external to the model file so that it loads in a desired position. Perhaps through additional tag attributes.
A good use case for this is when loading content from a 3rd party that you don't have edit control over but want to load in a specific orientation.
This has come up in other discussions we have had. I think a top-level rigid transform is not out of the question for us, and has been demonstrated to be desirable for some use cases.
That said, a lot of cases can be handled by the attributes we already have: camera-orbit and camera-target. These attributes let you position the camera relative to the model, which will have the same end result in many cases. Have you tried using those attributes?
Yes, camera positioning will definitely work in some cases but a common use case for us (Smithsonian) would be more about relative positioning of objects from different source files (which I know is also not yet supported) which would need rigid transforms.
@gjcope thanks for confirmation!
For the multi-object use case, the only current idea we have floated is to enable that via 3DOM, peusdocoded:
<model-viewer src="some.glb">
<script type="experimental-scene-graph-worklet" allow="node-hierarchy; node-transforms; load-models">
addEventListener('model-change', () => {
// Translate the model loaded from 'some.glb'
model.scene.nodes[0].setTranslation(...);
loadModel('other.glb').then((otherModel) => {
// Translate the model loaded from 'other.glb'
otherModel.scene.nodes[0].setTranslation(...);
// Append the other model to some model's scene graph
model.scene.appendModel(otherModel);
});
});
</script>
</model-viewer>
Although this theoretically gives you the capability to do what you describe, I wonder if there is a corresponding declarative form to accomplish something similar (e.g., put one model inside another, and apply transformations to both).
At any rate, I think a top-level rigid transform may make sense for us to add.
cc @elalish for additional commentary.
A top-level transform attribute sounds like a good idea. Even for the single-object case, you want it to be oriented properly relative to the world. Otherwise, for a model that is flipped on its side, camera controls would get confusing.
Most helpful comment
A top-level transform attribute sounds like a good idea. Even for the single-object case, you want it to be oriented properly relative to the world. Otherwise, for a model that is flipped on its side, camera controls would get confusing.