Tileset root transform does not match Tiled location arguments

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

1 Like

Hello Tom, Sorry we didn’t respond to your question sooner.
You’re correct that the tiler will move the origin of the tileset. This sets the model up for more optimal tiling. However, it shouldn’t show up in the incorrect place on the globe because of this.

I’m a little confused by the code sample you provided above. What is the result of setting the modelMatrix for the tileset? Because the position is set in the root.transform, I wouldn’t think you’d need to use the modelMatrix at all. Can you also please explain what’s in the screenshot you’ve included?

Best Regards,

Hannah