Hi! I am trying to get the bounding box of an entity using the dataSourceDisplay.getBoundingSphere()
function. On sandcastle, the function does not write any value to the bounding sphere object I pass in:
// create an entity
const blueBox = viewer.entities.add({
name: "Blue box",
position: Cesium.Cartesian3.fromDegrees(-114.0, 40.0, 300000.0),
box: {
dimensions: new Cesium.Cartesian3(400000.0, 300000.0, 500000.0),
material: Cesium.Color.BLUE,
},
});
// get the bounding sphere
let boundingSphere = new Cesium.BoundingSphere();
const state = viewer.dataSourceDisplay.getBoundingSphere(
blueBox,
false,
boundingSphere
);
viewer.camera.viewBoundingSphere(boundingSphere);
In my local environment, it raises a runtime error:
F12 trace to here
I am using windows with cesium@1.106.1
, the codebase is just the cesium webpack example with similar code in the sandcastle example above added.
How should I get the bounding sphere of an entity?