threejs version 167
three.js editor import is ok
but localhost is error
var gltfLoader = new GLTFLoader();
var dracoLoader = new DRACOLoader();
dracoLoader.setDecoderPath(“/xiangyang/ConlargeScreen/sanwei/draco/gltf/”);
dracoLoader.setDecoderConfig({type: “js”});
// dracoLoader.preload();
gltfLoader.setDRACOLoader(dracoLoader);
gltfLoader.setMeshoptDecoder(MeshoptDecoder);
gltfLoader.load(‘/xiangyang2.glb’, function (gltf) {
}, function (error) {
console.error(error);
});
That error comes from here and the loader was unable to reconstruct the xiangyang2.glb
file.
Maybe try loading your xiangyang2.glb
in the glTF Viewer or even gltf.report to see if they might show the error.
three.js editor is ok
There is a simple test you can perform.
Just copy one of the official three.js GLB files to the same folder where your xiangyang2.glb
file is and then replace the name in your code.
If you get the same error then it could be the path that’s incorrect for your localhost server.