【问题标题】:AFrame and the camera motion - identical to the inspectorAFrame 和相机运动 - 与检查器相同
【发布时间】:2019-01-11 10:35:56
【问题描述】:

我有兴趣设置一个 AFrame 场景,它与我们调用“检查器 (Ctrl+Alt+I)”时得到的相机运动完全相同。

  • 左键用于移动相机
  • 用于缩放的滚轮
  • 右击移动相机而不旋转

这是一个等效的设置,可以在 CAD - CAO 软件中找到,例如 rhino。

目前我有这个设置,没有滚轮缩放,这不自然:

    <a-entity look-at="#WorldFrame" look-controls>
        <a-entity position="7 0 -7" rotation="0 135 0">
            <a-camera fov="20" zoom="0.6" look-controls="enabled:false">
                <a-cursor></a-cursor>
            </a-camera>
        </a-entity>
    </a-entity>

有什么线索吗? 谢谢

编辑: 左键的正确配置似乎如下:

    <a-entity id="cameraTarget" position="0 0 0" rotation="0 0 0" look-controls >
        <a-entity position="7 0 7" >
            <!-- Disable the default wasd controls we are using those to control the ship -->
            <a-camera id="cameraID" fov="20" zoom="0.6" look-controls="enabled:false">
                <a-cursor></a-cursor>
            </a-camera>
        </a-entity>
    </a-entity>

我仍然不知道滚轮和右键单击?

【问题讨论】:

    标签: controls aframe


    【解决方案1】:

    您可以使用aframe-orbit-controls

    <head>
      <title>My A-Frame Scene</title>
      <script src="https://aframe.io/releases/0.8.2/aframe.min.js"></script>
      <script src="https://unpkg.com/aframe-orbit-controls@1.2.0/dist/aframe-orbit-controls.min.js"></script>
      <script src="https://unpkg.com/aframe-supercraft-loader@1.1.3/dist/aframe-supercraft-loader.js"></script>
    </head>
    
    <body>
      <a-scene>
        <a-entity supercraft-loader="name: icky-snake"></a-entity>
        <a-entity camera look-controls orbit-controls="target: 0 1.6 -0.5; minDistance: 0.5; maxDistance: 180; initialPosition: 0 5 15"></a-entity>
      </a-scene>
    </body>
    

    【讨论】:

    • 非常感谢您的工作。感谢您的回答解决了问题。您是否知道是否有可能减少鱼眼效应。我尝试使用 fov 和 zoom 属性,但它们没有更多效果?
    • 嗯,相机 fov 应该这样做。默认相机不应该有太多的鱼眼。您确实将其设置为 20 对吗?
    • 是 20。但似乎没有效果。请注意,在您的解决方案中,我们不再使用 标记,而是使用相机组件的实体。这有什么不同吗?
    • 我编辑了 fov 的答案,但在我的电脑上全屏显示时,轨道控制丢失了。
    • 我已经更新了我们自己的轨道控制github.com/supermedium/superframe/tree/master/components/…
    猜你喜欢
    • 1970-01-01
    • 2017-04-28
    • 1970-01-01
    • 2021-04-04
    • 1970-01-01
    • 1970-01-01
    • 2012-04-04
    • 2016-08-09
    • 2015-04-03
    相关资源
    最近更新 更多