小编JES*_*LIN的帖子

未捕获的类型错误:THREE.GLTFLoader 不是构造函数

我是三个 js 的新手我无法弄清楚错误

当我运行我的代码时,显示以下错误

未捕获的类型错误:THREE.GLTFLoader 不是构造函数

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.log((xhr.loaded / xhr.total * 100 ) + '% loaded' );
            },

            function (error) {
                console.log( 'An error happened = ', error );
            }
        );
Run Code Online (Sandbox Code Playgroud)

错误是在 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>
Run Code Online (Sandbox Code Playgroud)

并且 GLTFLoader.js 在路径中: …

three.js hapi.js

5
推荐指数
2
解决办法
1万
查看次数

标签 统计

hapi.js ×1

three.js ×1