1. A concise explanation of the problem you're experiencing.
Hi guys, when I loaded my 3D module, it just kept telling me "RuntimeError: Failed to load model: [object Object]" but I can't fix the problem. However, when using the sample data, it worked. By the way, I'm using Cesium-1.41 version.
2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.
var viewer = new Cesium.Viewer('cesiumContainer', {
infoBox : false,
selectionIndicator : false,
shadows : true,
shouldAnimate : true
});
function createModel(url, height) {
viewer.entities.removeAll();
var position = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, height);
var heading = Cesium.Math.toRadians(135);
var pitch = 0;
var roll = 0;
var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr);
var entity = viewer.entities.add({
name : url,
position : position,
orientation : orientation,
model : {
uri : url,
minimumPixelSize : 128,
maximumScale : 20000
}
});
viewer.trackedEntity = entity;
}
var options = [{
text : 'Aircraft',
onselect : function() {
createModel('../../../../Apps/SampleData/models/CesiumAir/Cesium_Air.glb', 5000.0);
}
}, {
text : '101',
onselect : function() {
createModel('../../../../Apps/SampleData/models/01/101-2.glb', 0);
}
}];
Sandcastle.addToolbarMenu(options);
The console shows:
RuntimeError: Failed to load model: [object Object]
Error
at new RuntimeError (https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:10302:19)
at https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:141603:40
at Promise.then (https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:8896:33)
at https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:8976:13
at processQueue (https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:9326:4)
at _resolve (https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:9012:4)
at promiseReject (https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:9045:11)
at Promise.then (https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:8896:33)
at https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:8977:7
at processQueue (https://cesiumjs.org/Cesium/Build/CesiumUnminified/Cesium.js:9326:4)
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
4. The Cesium version you're using, your operating system and browser.