Я новичок в THREE js, я не могу понять ошибку
когда я запускаю свой код, отображается следующая ошибка
Uncaught TypeError: THREE.GLTFLoader is not a constructor
var loader = new THREE.GLTFLoader();
loader.load('modelReq/Gully_update_2.gltf',
function (gltf) {
scene.add(gltf.scene);
gltf.animations;
gltf.scene;
gltf.scenes;
gltf.cameras;
gltf.asset;
},
function (xhr) {
console.info((xhr.loaded / xhr.total * 100 ) + '% loaded' );
},
function (error) {
console.info( 'An error happened = ', error );
}
);
и ошибка на var loader = new THREE.GLTFLoader();
Мой html файл:
<link rel = "stylesheet" href = "css/main.css">
<script src = "js/plugins/three.min.js"></script>
<script src = "js/plugins/TrackballControls.js"></script>
<script src = "js/plugins/stats.min.js"></script>
<script src = "js/plugins/GLTFLoader.js"></script>
<script src = "js/custom.js"></script>
</head>
<body>
<div id = "animate">
<canvas></canvas>
</div>
и GLTFLoader.js находится по пути: <script src = "js/plugins/GLTFLoader.js"></script>





GLTFLoader находится в отдельном файле ...
<script src = "https://cdn.rawgit.com/mrdoob/three.js/master/examples/js/loaders/GLTFLoader.js"></script>
Примечание. В рамках перехода на модули ES6 файлы в «examples / js» устарели в мае 2020 года (r117) и будут удалены в декабре 2020 года (r124).
Откуда вы берете свой THREE.js? Я бы попробовал загрузить его из CDN в Интернете, пока он не заработает. Я думаю, вы загружаете версию, предназначенную для использования с модулями или чем-то еще. <script src = "threejs.org/build/three.min.js"></script> <script src = " cdn.rawgit.com/mrdoob/three.js/master/examples/js/contr ols /…> Попробуйте получить свои сценарии из одного из этих мест ^.