Using 3D tiles generated from Context Capture, the tiles are positioned above the world.I've tried building Cesium myself by cloning Cesium,Then replace the Cesium folder in your App folder with the Build/Cesium folder that was just generated. but that doesn't have much of an effect.
How can I make sure the model is positioned on top of the terrain?
var viewer = new Cesium.Viewer('cesiumContainer', {
timeline:false,
animation:false,
vrButton:true,
sceneModePicker:false,
infoBox:true,
baseLayerPicker:false,
scene3DOnly:true,
terrainProviderViewModels: terrainModels,
selectedTerrainProviderViewModel: terrainModels[1], // Select STK high-res terrainimageryProvider : new Cesium.ArcGisMapServerImageryProvider({
url : 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer'
})
});viewer.scene.globe.depthTestAgainstTerrain = false;
var boundingSphere = new Cesium.BoundingSphere(Cesium.Cartesian3.fromDegrees(6.681247027, 46.55189101, 871.5000123), 493.3407689);viewer.homeButton.viewModel.command.beforeExecute.addEventListener(function(commandInfo) {
// Fly to custom position
viewer.camera.flyToBoundingSphere(boundingSphere);// Tell the home button not to do anything
commandInfo.cancel = true;
});
viewer.camera.flyToBoundingSphere(boundingSphere, {duration: 0});var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
url: '../Scene/Production_4.json',
maximumScreenSpaceError : isMobile.any() ? 8 : 1, // Temporary workaround for low memory mobile devices - Increase maximum error to 8.
maximumNumberOfLoadedTiles : isMobile.any() ? 10 : 1000 // Temporary workaround for low memory mobile devices - Decrease (disable) tile cache.
}));var heightOffset = 0;
tileset.readyPromise.then(function(tileset) {
console.log("STARTING!!");
var boundingSphere = tileset.boundingSphere;
viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0, -2.0, 0));
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
// Position tileset
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());
tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
console.log(tileset.modelMatrix);
});
Hi thereI added the code,but it doesn't work well,there is no change about the height,Sean said that we should do something just like 'npm run minifyRelease', I have tried this also,but there is always something wrong,so that I can't create a new cesium branch, It is really terrible! I have no idea now,please give me a hand.Jack---Original---From: "Rachel Hwang"<elkw...@gmail.com>Date: 2017/6/17 02:38:24To: "cesium-dev"<cesiu...@googlegroups.com>;Cc: "280147597"<2801...@qq.com>;Subject: [cesium-dev] Re: 3D Tiles Building positioned above the world.HELP!
--
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/3p5XyXAzkbs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.