Set 3dtileset clamp(boundSphere.center up on tileset)

Hi, I get some porblem when i tried to set 3dtileset clamp to ground.
I loaded the 3dtileset and tried to set it clamp to ground by

var cartographic = Cesium.Cartographic.fromCartesian(
tileset.boundingSphere.center
);
var surface = Cesium.Cartesian3.fromRadians(
cartographic.longitude,
cartographic.latitude,
cartographic.height
);
var offset = Cesium.Cartesian3.fromRadians(
cartographic.longitude,
cartographic.latitude,
0
);
var translation = Cesium.Cartesian3.subtract(
offset,
surface,
new Cesium.Cartesian3()
);
tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);

and I found the tileset in the underground(because the tileset boundSphere center is some distance above the model rather than in the center of the model).
how could i set it to clamp ground correctly?

Hiya,

Are you using a terrain, or just the plain ellipsoid? It very often comes down to accuracy, of your models and of your terrain (if you got one).

If you use a terrain and it’s accurate, you can probably sample your way to the right height (let terrain load, then sample height at the boundingSphere, add model, sample again, and adjust height according to the difference in height between the two), but if you don’t it’s always a bit tricky because you need to know at what height your model looks fine on the ellipsoid. Some tilesets come with a min and max height property, so if you know the min you can always try to transform it to that.

in my world, our customers most often have very accurate models / tilesets, so they will always match up nicely to accurate terrain models. It’s mostly non-accurate data that’s an issue. And remember that there’s a difference between a visual representation of data, and an accurate working with data. If you’re doing measurements on inaccurate data, your measurements will equally be inaccurate.

Cheers,

Alex

thanks for reply.
I didn’t set any terrain( just the plain ellipsoid)
I haven’t find any code solution to solve it.
Maybe the center only could be reset by modeling software such as Blander.
I’ll try it