Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
919 views
in Technique[技术] by (71.8m points)

camera - How can I disable device motion and device orientation?

I have this 3D scene running on my website:

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

But I do not want the camera view to update according to the device motion/orientation.

I want only the gesture input for mobile and mouse input for desktop. Here is my code so far:

<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/[email protected]/dist/aframe-orbit-controls.min.js"></script>
  <script src="https://unpkg.com/[email protected]/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>

Please note, I am also using aframe-orbit-controls from https://www.npmjs.com/package/aframe-orbit-controls

I am aware there is an option to disable the UI but I want to disable the functionality altogether.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...