更改模型的初始位置和旋转 [英] Change initial position and rotation of a model

查看:27
本文介绍了更改模型的初始位置和旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用加载特定模型的 A-Frame 获得了一个简单的 .html 文件.

<头><meta charset="utf-8"><title>八分仪 - Dodds, H. &佩雷斯,T.</title><meta name="description" content="存在于分类法文章中"><script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script><身体><a-scene background="color: #FAFAFA"><a-资产><a-asset-item id="octant" src="octant.glb"></a-asset-item></a-资产><a-entity gltf-model="#octant"></a-entity>

对象在页面上加载良好(

如果我往下看,我能看到一架飞机

但是想在开始时看到以下内容

使用 A-Frame Inspector 我能够看到这在位置 0、0.347、-3 和旋转 0、58.0274、-0.27 中非常适合.

我尝试将位置和旋转添加到

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?

解决方案

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

这篇关于更改模型的初始位置和旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆