aframe-alongpath-component icon indicating copy to clipboard operation
aframe-alongpath-component copied to clipboard

Cannot read property `curve` of undefined in tick

Open ngokevin opened this issue 8 years ago • 1 comments

Have you seen this error?

<!DOCTYPE html>
<html>
  <head>
    <title>Registry - A-Frame School</title>
    <meta name="description" content="Registry - A-Frame School">
    <script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
    <script src="https://unpkg.com/aframe-alongpath-component@%5E1.0.x/dist/aframe-alongpath-component.min.js"></script>
    <script src="https://unpkg.com/[email protected]/dist/aframe-animation-component.min.js"></script>
    <script src="https://unpkg.com/[email protected]/dist/aframe-particle-system-component.min.js"></script>
  </head>
  <body>
    <a-scene>
      <a-assets>
        <img id="groundTexture" src="https://img.gs/bbdkhfbzkk/stretch/https://i.imgur.com/25P1geh.png">
      </a-assets>
      
      <a-curve id="track">
        <a-curve-point position="-2 2 -3"></a-curve-point>
        <a-curve-point position="0 1 -3"></a-curve-point>
        <a-curve-point position="2 2 -3"></a-curve-point>
      </a-curve>

      <a-entity particle-system="preset: snow; particleCount: 10000"></a-entity>
      <a-entity particle-system="preset: default; color: #515; particleCount: 1000" position="0 0 -5"></a-entity>

      <a-entity id="sphere" geometry="primitive: sphere; radius: 1.25" material="color: #EF2D5E" position="0 1.25 -5"
                animation="property: scale; dir: alternate; dur: 100; to: 1.1 1.1 1.1; loop: true"></a-entity>
      <a-entity id="box" geometry="primitive: box; width: 1; depth: 1; height: 1" position="-1 0.5 -3" material="color: #4CC3D9"></a-entity>
      <a-entity id="cylinder" geometry="primitive: cylinder; radius: 0.5; height: 1.5" position="1 0.75 -3" material="color: #FFC65D"
                alongpath="curve: #track"></a-entity>

      <a-entity id="plane" geometry="primitive: plane; width: 10000; height: 10000" material="color: #333; src: #groundTexture; repeat: 10000 10000; transparent: true; metalness: 0.6; roughness: 0.4" rotation="-90 0 0"></a-entity>
      <a-entity id="sky" geometry="primitive: sphere; radius: 100" material="color: #666; shader: flat; side: back"></a-entity>
      <a-entity light="type: ambient; color: #444"></a-entity>
      <a-entity light="type: directional; color: #AAA" position="-1 2 0"></a-entity>
    </a-scene>
  </body>
</html>
Uncaught TypeError: Cannot read property 'curve' of undefined
    at i.tick (https://unpkg.com/[email protected]/dist/aframe-alongpath-component.min.js:1:1099)
    at https://aframe.io/releases/0.5.0/aframe.min.js:250:6254
    at Array.forEach (native)
    at HTMLElement.value (https://aframe.io/releases/0.5.0/aframe.min.js:250:6216)
    at HTMLElement.value (https://aframe.io/releases/0.5.0/aframe.min.js:250:6410)
    at HTMLElement.render (https://aframe.io/releases/0.5.0/aframe.min.js:369:132)
    at e (https://aframe.io/releases/0.5.0/aframe.min.js:250:5590)
    at HTMLElement.<anonymous> (https://aframe.io/releases/0.5.0/aframe.min.js:250:5767)
    at Object.module.exports.fireEvent (https://aframe.io/releases/0.5.0/aframe.min.js:384:2041)
    at https://aframe.io/releases/0.5.0/aframe.min.js:240:2772

ngokevin avatar Mar 29 '17 00:03 ngokevin

Hi,

The alongpath-component has a dependency for the "aframe-curve-component". I added a better error-handling... but should probably also make this explicit using the dependency flag.

Try adding both: https://unpkg.com/[email protected]/dist/aframe-curve-component.min.js https://unpkg.com/[email protected]/dist/aframe-alongpath-component.min.js

vedmakk avatar Jul 10 '17 10:07 vedmakk