更改模型的初始位置和旋转 [英] Change initial position and rotation of a model
问题描述
使用加载特定模型的A-Frame获得一个简单的.html文件.
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
使用A框架检查器,我发现它在位置0,0.347,-3和旋转0,58.0274,-0.27时非常合适.
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.
我尝试将位置和旋转添加到<a-assets>
和<a-asset-item ... >
,但是看不到任何变化.
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?
推荐答案
一个人需要在<a-entity>
中添加该信息,就像这样
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>
这是最终结果
这篇关于更改模型的初始位置和旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!