OrbitControls.js - 无法读取未定义的 属性 'prototype'

OrbitControls.js - Cannot read property 'prototype' of undefined

我正在 Three.js 中启动一个项目,并且我已经正确导入了库 OrbitControls.js,但是当我打开控制台进行测试时,我看到以下错误:

Cannot read property 'prototype' of undefined

与OrbitConstrols.js里面的下面一行代码有关:

THREE.OrbitControls.prototype = Object.create( THREE.EventDispatcher.prototype );

我找到了类似的例子来研究这个问题的解决方案,比如 this one,但它是为 Typescript 制作的。

你知道解决这个问题的可能方法吗?或者它只是库的一个错误,即使我得到一个错误,对象也会被正确渲染?

我不知道你是如何在 HTML 中添加这个的,但是 添加 OrbitControls 时的顺序很重要 因为它需要 Three.js 中的某些东西.

应该是

    <script src="../build/three.min.js"></script>
    <script src="js/controls/OrbitControls.js"></script>

示例是找出错误的最佳方式 - threejs.org/examples/misc_controls_orbit.html