0
votes

I am trying to use a-frame with a-frame physics system. However, it has never worked in my environment (Mac OS 10.13, chrome, node.js Express server).

  • It reads the script file (cdn.rawgit.com/donmccurdy/aframe-physics-system/v3.2.0/dist/aframe-physics-system.js). However, when I add "dynamic-body" or "static-body" property, I receive the error.
  • I tried to run this code on other browsers, and other server hosts, but the result is the same.

The below is the code:

<!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>

And the below is the error I get.

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
1

1 Answers

0
votes

Don't use such an old version of a-frame. Bumping it up to version 0.8.2 fixes the issue:

   <script src="https://aframe.io/releases/0.8.2/aframe.min.js"></script>

Have fun!