We’re using the Cesium ION Engine to tile our models. In our app, when a tileset is loaded, the location of the tileset is updated to match lat/long values input by the user.
For example, tiling a photogrammetry model with location arguments:
- longitude: 0.8025153
- latitude: 52.6592013
When querying tileset.root.transform or tileset.boundingSphere.center, the location is now:
- longitude: 0.8019354005717253
- latitude: 52.661085199167644
When the tileset is loaded, we update the location by:
// either tileset.root.transform or tileset.boundingSphere.center to set
// the originalLocation variable
const rootTransform = tileset.root.transform;
let originalLocation = new Cesium.Cartesian3();
Cesium.Matrix4.getTranslation(rootTransform, originalLocation);
// lat/long are requested from API, hard coded below for reference:
const offset = Cesium.Cartesian3.fromDegrees(0.8025153, 52.6592013, 0);
const translation = Cesium.Cartesian3.subtract(offset, originalLocation, new Cesium.Cartesian3());
tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
Because the offset variable should match the original tiled location using the ION engine, the model should be located in the same place, and the translation should be zero. But because there are discrepancies between the tiled arguments and the root transform, the translation doesn’t equal zero and the model is placed in the wrong position.
Is there a way to access the original tiled location somehow to be able to perform an accurate transform? As it looks like the origin of the model has been updated so it no longer matches the original lat/long set in the tiler args.
Thanks,
Tom