Issue loading gltf with webpack

37 views
Skip to first unread message

nicolas.d...@delair.aero

unread,
Aug 27, 2019, 5:02:55 AM8/27/19
to cesium-dev
1. A concise explanation of the problem you're experiencing.

cesium.png

Hi,
I'm using webpack and cesium. I'm getting the error visible on the attached screenshot.


2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.

var Cesium = require('cesium/Cesium');
require('./css/main.css');
require('cesium/Widgets/widgets.css');

var viewer = new Cesium.Viewer('cesiumContainer');

var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(
    Cesium.Cartesian3.fromDegrees(-75.62898254394531, 40.02804946899414, 2000.0));

var model = viewer.scene.primitives.add(Cesium.Model.fromGltf({
    url : 'data/Model2.glb',
    modelMatrix : modelMatrix,
    scale : 20000.0
}));

viewer.zoomTo(model);

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.

Cesium 1.60
MacOS
Firefox


Omar Shehata

unread,
Aug 27, 2019, 1:36:39 PM8/27/19
to cesium-dev
This is actually not a problem not an issue with webpack. You'll see the same error if you try it in Sandcastle:

var viewer = new Cesium.Viewer('cesiumContainer');

var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(
    Cesium.Cartesian3.fromDegrees(-75.62898254394531, 40.02804946899414, 2000.0));

var model = viewer.scene.primitives.add(Cesium.Model.fromGltf({
    url : '../../SampleData/models/CesiumAir/Cesium_Air.glb',
    modelMatrix : modelMatrix,
    scale : 20000.0
}));

viewer.zoomTo(model);


 The problem is the viewer.zoomTo method does not take a model. You could try passing in the position of the model and offset, with the viewer.camera.flyTo or viewer.camera.zoomTo methods, or use an Entity which will allow you to just do viewer.zoomTo(model) like in this example:


Let me know if that helps.

Nicolas Derouineau

unread,
Aug 28, 2019, 8:11:51 AM8/28/19
to cesiu...@googlegroups.com
Thanks, I thought that viewer.zooTo was equivalent to viewer.camera.zoomTo. Thanks for the feedback !

--
You received this message because you are subscribed to a topic in the Google Groups "cesium-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cesium-dev/eiqFheT2284/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cesium-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cesium-dev/a7f19231-9452-4cdd-8db2-3157451bda00%40googlegroups.com.

Omar Shehata

unread,
Aug 28, 2019, 1:26:43 PM8/28/19
to cesium-dev
Glad to hear that worked!

What kind of project are you working on? 
To unsubscribe from this group and all its topics, send an email to cesium-dev+unsubscribe@googlegroups.com.

nicolas.d...@delair.aero

unread,
Aug 29, 2019, 4:51:32 AM8/29/19
to cesium-dev
Mostly on 3D landscapes visualization.


On Wednesday, August 28, 2019 at 7:26:43 PM UTC+2, Omar Shehata wrote:
Glad to hear that worked!

What kind of project are you working on? 

On Wednesday, August 28, 2019 at 8:11:51 AM UTC-4, Nicolas Derouineau wrote:
Thanks, I thought that viewer.zooTo was equivalent to viewer.camera.zoomTo. Thanks for the feedback !

On Tue, Aug 27, 2019 at 7:36 PM Omar Shehata <omar.sam...@gmail.com> wrote:
This is actually not a problem not an issue with webpack. You'll see the same error if you try it in Sandcastle:

var viewer = new Cesium.Viewer('cesiumContainer');

var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(
    Cesium.Cartesian3.fromDegrees(-75.62898254394531, 40.02804946899414, 2000.0));

var model = viewer.scene.primitives.add(Cesium.Model.fromGltf({
    url : '../../SampleData/models/CesiumAir/Cesium_Air.glb',
    modelMatrix : modelMatrix,
    scale : 20000.0
}));

viewer.zoomTo(model);


 The problem is the viewer.zoomTo method does not take a model. You could try passing in the position of the model and offset, with the viewer.camera.flyTo or viewer.camera.zoomTo methods, or use an Entity which will allow you to just do viewer.zoomTo(model) like in this example:


Let me know if that helps.

To unsubscribe from this group and all its topics, send an email to cesiu...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages