Changing model's center

I’m adding various glTF models (I do not have control over their creation) into Cesium. Many of the models end up with strange boundingSpheres and centers in Cesium. Is there any way to edit the center pivot point of a model?

Note: The models originate as Collada files that I’m uploading to Cesium ION to convert into glTF.

I think when converting a model to glTF with Cesium ion, it should retain its origin (vs tiling it to 3D Tiles, where it computes a new origin, see How to correctly position 3D models when tiling with Cesium ion).

Are you seeing a different origin from the source model? Can you share a Sandcastle example showing this? See How to share custom Sandcastle examples

It’s likely that the original Collada files have poor origins. So I’m looking for a way to change the origin programmatically, hopefully within Cesium, or if not by somehow editing the Collada or glTF files.

Here’s an example. As you can see the origin is far off from the actual model, and rotating it results in a big change in position.

ION’s 3D Tiles does do a good job of computing the origin in the actual center of the model. However I need to programmatically move the model’s position in Cesium, and 3D Tiles can only have their position set manually in ION (I believe?).

So back to glTF models, where I can edit model.position but not model.boundingSphere. Again, any ideas on how to change the center pivot point within the model would be appreciated!

There’s a couple of ways to programmatically position your model. My recommendation is to use the Cesium ion REST API to upload your model and pass in a longitude, latitude, and height. This will allow you to accurately position where the origin of your geometry should be on the globe.

I don’t think this is possible in CesiumJS - you would need to reposition your model geometry itself in the glTF file before importing. Or one easy thing I’ve seen many glTF models do is create an empty root node that acts as an offset so you can easily translate the origin without editing all the geometry.

In this case I need to rapidly change the model’s location locally, so calling the REST API each time for the 3D Tiles model wouldn’t work. Any other ways to do it?

I’m using ION to convert COLLADA files to glTF, and don’t know the origin until loaded via ION. Is it possible to edit the glTF model once it’s in ION?

Thanks Omar.