I've tried playing with the z axis bounding sphere in the root.json, 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
});
var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
url: '/3dmodel/root.json',
maximumScreenSpaceError: 2,
maximumNumberOfLoadedTiles: 1000
}));
var viewer = new Cesium.Viewer('cesiumContainer', {
scene3DOnly : true
});
var scene = viewer.scene;
var heightOffset = 23.0;
var url = '../../../Specs/Data/Cesium3DTiles/Tilesets/Tileset';
var tileset = scene.primitives.add(new Cesium.Cesium3DTileset({
url : url
}));
tileset.readyPromise.then(function(tileset) {
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);
});
I've tried your code, and it doesn't seem to making a difference to the height, even if I make the number something crazy like 2000. Am I missing something?
var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
url: '/3dmodel/root.json'
// maximumScreenSpaceError: 2,
// maximumNumberOfLoadedTiles: 1000
}));
var heightOffset = 250.0;
tileset.readyPromise.then(function(tileset) {
console.log("STARTING!!")
var viewer = new Cesium.Viewer('cesiumContainer');
var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
url: '../../../Specs/Data/Cesium3DTiles/Tilesets/Tileset/'
// maximumScreenSpaceError: 2, // maximumNumberOfLoadedTiles: 1000}));
var heightOffset = 500.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);});
Thanks for sending it over. The issue is that the Cesium build exported from Context Capture into your project is a bit out-of-date, and doesn't include the `tileset.modelMatrix` property or the ability to transform tiles in general. When I loaded your tileset in Sancastle on the 3d-tiles branch it worked fine.To get around this in the meantime you can build Cesium yourself by cloning Cesium, checking out the 3d-tiles branch, and running `npm run minifyRelease` from the root directory. Then replace the Cesium folder in your App folder with the Build/Cesium folder that was just generated.By the way, I also noticed that your tileset looks best with `viewer.scene.globe.depthTestAgainstTerrain = true` instead of false.
On Friday, January 27, 2017 at 7:07:26 PM UTC-5, Sean Lilley wrote:
--
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/CqYeu6L6bhU/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.
Saturday, 28 January 2017 8:07 AM
Would you mind sharing the tileset? If you don't want to post in publicly feel free to email me at sli...@agi.com
On Friday, January 27, 2017 at 11:10:59 AM UTC-5, alex....@axpd.org wrote:
--
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/CqYeu6L6bhU/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.
Saturday, 28 January 2017 12:10 AM
Definitely no movement at all :/
Here is the out put from modelMatrix:
0:1
1:0
2:0
3:0
4:0
5:1
6:0
7:0
8:0
9:0
10:1
11:0
12:-184.08340326650068
13:381.49443915858865
14:-265.6601090361364
15:1
Thursday, 26 January 2017 9:23 AM
That is strange.. when I run the code with the sample tilesets it works ok
var viewer = new Cesium.Viewer('cesiumContainer');var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({url: '../../../Specs/Data/Cesium3DTiles/Tilesets/Tileset/'// maximumScreenSpaceError: 2,// maximumNumberOfLoadedTiles: 1000}));var heightOffset = 500.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 tilesetvar 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);});
What does console.log(tileset.modelMatrix); print for you?
On Tuesday, January 24, 2017 at 9:57:05 PM UTC-5, alex....@axpd.org wrote:
--
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/CqYeu6L6bhU/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.
Wednesday, 25 January 2017 10:57 AM