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.
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.