【发布时间】:2020-03-04 03:08:19
【问题描述】:
所以,我已经被这个问题难住了一段时间了。我需要能够让我的相机实体与 A 帧场景中的形状实体发生碰撞,从而阻止相机穿过它们。本质上,我想使用 A-Frame 物理引擎创建墙壁,可以在这里找到:
https://github.com/donmccurdy/aframe-physics-system
我找遍了,找不到一个简单的例子来说明如何获得这个功能!我已经花了太多时间在网上四处寻找。
我在 A-Frame 中创建了一个简单的场景,其中已经包含了 Don 的物理引擎的基础知识。我创建它是为了在将其添加到我正在处理的更复杂的场景之前尝试测试单个墙功能。
对此的任何帮助将不胜感激!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://aframe.io/releases/1.0.3/aframe.min.js"></script>
<script src="//cdn.rawgit.com/donmccurdy/aframe-physics-system/v4.0.1/dist/aframe-physics-system.min.js"></script>
<title>Aframe Physics Demo</title>
</head>
<body>
<a-scene physics="debug: true">
<a-entity id="camera" position="0 1.6 0">
<!-- Camera Entity -->
<a-entity id="camera" acceleration="200w" camera look-controls wasd-controls></a-entity>
</a-entity>
<a-box static-body position="0 0 -3" color="#4CC3D9" width="8" height="5" depth="0.5"></a-box>
<a-plane static-body rotation="-90 0 0" position="0 0 -4" width="10" height="10" color="#7BC8A4"></a-plane>
<a-sky color="#ECECEC"></a-sky>
</a-scene>
</body>
</html>
【问题讨论】:
标签: javascript html aframe