问题
Got a simple .html file using A-Frame that loads a specific model.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Octant Cube - by Dodds, H. & Peres, T.</title>
<meta name="description" content="Present in the Taxonomy article">
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
</head>
<body>
<a-scene background="color: #FAFAFA">
<a-assets>
<a-asset-item id="octant" src="octant.glb"></a-asset-item>
</a-assets>
<a-entity gltf-model="#octant"></a-entity>
</body>
</html>
The object loads fine on the page (as the documentation suggests) but this is what I see at first
If I look all down I'm able to see one plane
But would like to see the following at start
Using the A-Frame Inspector I was able to see this would suit nice in the position 0 , 0.347, -3 and rotation 0, 58.0274, -0.27.
I tried adding the position and rotation to <a-assets>
and <a-asset-item ... >
but no change was possible to be seen.
How can I change the initial position and the rotation of the model?
回答1:
One needs to add that information in <a-entity>
instead, like this
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Octant Cube - by Dodds, H. & Peres, T.</title>
<meta name="description" content="Present in the Taxonomy article">
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
</head>
<body>
<a-scene background="color: #FAFAFA">
<a-assets>
<a-asset-item id="octant" src="octant.glb"></a-asset-item>
</a-assets>
<a-entity position="0 0.347 -4" rotation="0 60 -1" gltf-model="#octant"></a-entity>
</body>
</html>
This is the final result
来源:https://stackoverflow.com/questions/62139855/change-initial-position-and-rotation-of-a-model