我正在尝试将a框架与a框架物理系统一起使用。但是,它在我的环境(Mac OS 10.13,chrome,node.js Express服务器)中从未起作用。
下面是代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello world!</title>
<meta name="description" content="Hello world!">
<script src="https://aframe.io/releases/0.3.2/aframe.min.js"></script>
<script src="//cdn.rawgit.com/donmccurdy/aframe-physics-system/v3.2.0/dist/aframe-physics-system.js"></script>
</head>
<body>
<a-scene physics="debug: true">
<a-entity position="0 0 0">
<a-plane color="green" static-body height="3" width="3" rotation="-90 0 0" position="0 0 -5"></a-plane>
<a-box color="red" dynamic-body position="0 5 -5"></a-box>
</a-entity>
</a-scene>
</body>
</html>
以下是我得到的错误。
aframe-physics-system.js:5508 Uncaught TypeError: Cannot read property 'x' of undefined
at Vec3.copy (aframe-physics-system.js:5508)
at s.Body.syncToPhysics (aframe-physics-system.js:15876)
at s._play (aframe-physics-system.js:15729)
at s.initBody (aframe-physics-system.js:15670)
at Object.module.exports.fireEvent (index.js:28)
at a-node.js:208
at Array.map (<anonymous>)
at HTMLElement.value (a-node.js:207)
at a-node.js:104
答案 0 :(得分:0)
不要使用旧版本的A形镜架。将其更新到版本0.8.2可以解决此问题:
<script src="https://aframe.io/releases/0.8.2/aframe.min.js"></script>
玩得开心!