如何禁用设备运动和设备方向?

问题描述

我在我的网站上运行了这个 3D 场景:

https://immersify.co.uk/games/the-floor-is-lava

但我不希望相机视图根据设备运动/方向进行更新。

我只需要移动设备的手势输入和桌面的鼠标输入。到目前为止,这是我的代码:

<head>
  <meta charset="utf-8">
  <title>Scene Viewer</title>
  <meta name="description" content="Scene Viewer">
  <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" />
  <script src="https://aframe.io/releases/1.1.0/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
  device-orientation-permission-ui="enabled: false"
  vr-mode-ui="enabled: false"
  shadow="autoUpdate: false; enabled: false">

  <a-assets>
    <a-entity rotation="0 90 0">
      <a-asset-item rotation="0 0 0" id="walkway" src="a-frame-assets/walkway.glb"></a-asset-item>
      <a-asset-item id="lava" src="a-frame-assets/lava.glb"></a-asset-item>
    </a-entity>
  </a-assets>

  <a-entity
  camera="fov: 30" look-controls orbit-controls="target: 0 0 0; minDistance: 0.5; maxDistance: 180; initialPosition: 0 20 40;">

  <a-text value="< SWIPE >" scale=".2 .2 .2" position="0 -.2 -1" align="center" color="white"></a-text>
  </a-entity>

  <a-entity light="type: point; intensity: 5; color: #FFC100" position="0 4 0"></a-entity>
  <a-entity position="0 0 0" gltf-model="#walkway"></a-entity>
  <a-entity position="0 0 0" gltf-model="#lava"></a-entity>

</a-scene>
</body>
</html>

请注意,我也在使用来自 https://www.npmjs.com/package/aframe-orbit-controls

的 aframe-orbit-controls

我知道有一个选项可以禁用 UI,但我想完全禁用该功能。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...