Three.js - Uncaught TypeError: undefined is not a function

后端 未结 1 1113
逝去的感伤
逝去的感伤 2021-01-04 06:05

I\'m getting the Uncaught TypeError: undefined is not a function while using Three.js. The error is being shown for the line where I\'m creating a THREE.P

相关标签:
1条回答
  • 2021-01-04 06:44

    The problem with the local copy is you used the unbuilt Three.js file (that would be src/Three.js). The one you want is either build/three.js or build/three.min.js. I copied that into my project, and changed the reference to it in the script tag's src attribute, and it all started working.

    In short:

    mrdoob-three.js-2524525(or some other number here)
     |
     +----build
     |     |
     |     +--three.js     <-- YES, CORRECT FILE
     |     +--three.min.js <-- YES
     |     ...
     |
     +----src
     ...   |
           +--Three.js     <-- NO, PREBUILT FILE THAT ONLY CONTAINS CONSTANTS
           ...
    
    0 讨论(0)
提交回复
热议问题