Model.readyPromise.then(function(Model) {
var boundingSphere = Model.boundingSphere;
viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0, -2.0, 0));
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
center = Model.boundingSphere.center;
var cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center);
var surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0);
var offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, heightOffset);
var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
var heading = Cesium.Math.toRadians(10);
var pitch = Cesium.Math.toRadians(10);
var roll = Cesium.Math.toRadians(0);
var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
var result_teste = Cesium.Quaternion.fromHeadingPitchRoll(hpr,result_teste);
var rotacao = Cesium.Quaternion.subtract(result_teste,Cesium.Quaternion.IDENTITY, new Cesium.Quaternion());
var result = Cesium.Matrix4.fromTranslationQuaternionRotationScale(translation,rotacao , new Cesium.Cartesian3(1.0, 1.0, 1.0),result);
Model.modelMatrix =result;
});
I am trying that but it isn’t working. The model is disappering.
Have any ideia why?