Hi,
If you use eastNorthUpToFixedFrame and height = 0 the model will be above ground and with the right rotation. Check it out in sandcaslte:
Sandcastle code ( http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html )
// code snippet --->
var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;
function createModel(url, height) {
height = Cesium.defaultValue(height, 0.0);
var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(-75.62898254394531, 40.02804946899414, height));
scene.primitives.removeAll(); // Remove previous model
var model = scene.primitives.add(Cesium.Model.fromGltf({
url : url,
modelMatrix : modelMatrix
}));
model.readyToRender.addEventListener(function(model) {
// Play and loop all animations at half-spead
model.activeAnimations.addAll({
speedup : 0.5,
loop : Cesium.ModelAnimationLoop.REPEAT
});
// Zoom to model
var center = Cesium.Matrix4.multiplyByPoint(model.modelMatrix, model.boundingSphere.center, new Cesium.Cartesian3());
var transform = Cesium.Transforms.eastNorthUpToFixedFrame(center);
var camera = scene.camera;
camera.transform = transform;
var controller = scene.screenSpaceCameraController;
var r = 5.0 * Math.max(model.boundingSphere.radius, camera.frustum.near);
controller.minimumZoomDistance = r * 0.5;
camera.lookAt(new Cesium.Cartesian3(r, r, r), Cesium.Cartesian3.ZERO, Cesium.Cartesian3.UNIT_Z);
});
}
///////////////////////////////////////////////////////////////////////////
createModel(‘https://dl.dropboxusercontent.com/u/3050123/test.gltf’, 0);
// <---- code snippet
Quarta-feira, 17 de Setembro de 2014 11:09:40 UTC+1, Vladimir Elistratov escreveu: