I requested that the babylonjs sample.stL file display properly in the browser. When I put the.stl file on my own cloud server and sent the request, the task content was not displayed on the page, and the browser console reported an error.
I find that the response headers are the same, and the response also returns the content. Why does the error occur?
my code:
The same code works fine when I request https://models.babylonjs.com/Channel9/Channel9.stl
BABYLON.SceneLoader.ImportMeshAsync(
'',
'http://localhost:8906/api/bamboo/api-common/upload/download-file?obsPath=obs://dev/test/',
'Channel9.stl',
scene.current,
(sceneArg) => {
setLoading(false);
debugger
const boundingInfo = sceneArg[0].getBoundingInfo();
console.log('boundingInfo====', boundingInfo);
const ratio = 9.0 / boundingInfo.boundingSphere.radius;
sceneArg[0].position.y = (0 - boundingInfo.minimum.y) * ratio;
sceneArg[0].scaling.x = ratio;
sceneArg[0].scaling.y = ratio;
sceneArg[0].scaling.z = ratio;
// camera.setTarget(sceneArg[1]);
}
);