1. A concise explanation of the problem you're experiencing.
I am using a cesium Widget and want to use the flyToBoundingSphere, but the view goes to a strange location instead
2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.
var viewer = new Cesium.CesiumWidget('cesiumContainer', {
skyAtmosphere: false,
shouldAnimate : true,
terrainProvider: Cesium.createWorldTerrain()
});
var position = Cesium.Cartesian3.fromRadians(-2.0862979473351286, 0.6586620013036164, 1400.0);
var hpRoll = new Cesium.HeadingPitchRoll();
var hpRange = new Cesium.HeadingPitchRange();
var fixedFrameTransform = Cesium.Transforms.localFrameToFixedFrameGenerator('east', 'north');
var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(position, hpRoll, Cesium.Ellipsoid.WGS84, fixedFrameTransform);
var model = viewer.scene.primitives.add(Cesium.Model.fromGltf({
url : '../../../../Apps/SampleData/models/CesiumMan/Cesium_Man.glb',
modelMatrix: modelMatrix,
scale: 100.0,
}));
model.readyPromise.then(function(m){
// this does not work correctly
viewer.camera.flyToBoundingSphere(model.boundingSphere);
});
// I can successfully do the following, but I won't necessarily have position
1. viewer.scene.camera.flyTo({
destination: position
});
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
my actual need is to fly to the location where I can set up heading, pitch, range or heading, pitch, roll, like the following code which works
var center = Cesium.Matrix4.multiplyByPoint(model.modelMatrix, model.boundingSphere.center, new Cesium.Cartesian3());
//viewer.scene.camera.lookAt(center, new Cesium.HeadingPitchRange(0, 0, model.boundingSphere.radius*2.5));
4. The Cesium version you're using, your operating system and browser.
Cesium version: 1.43
OS - windows 10, chrome 66, updated latest