Hi,
I’m trying to load a model into cesium. Its a model of a wind turbine. The problem is that even though I have set it to Clamp_to_grounf, I still have to provide a ‘height’ value for it to render above the terrain. From reading another few posts, I figured this might have been due to a negative reference frame in the model, but if I move the location to a different place with different terrain height, the ‘height’ value is wrong, and it either renders above or below the terrain.
I’m load the model with this code
scene.globe.depthTestAgainstTerrain = true;
var addModel = function(long, lat){
var model = scene.primitives.add(Cesium.Model.fromGltf({
url: ‘/cesium/model/WindTurbine.gltf’,
modelMatrix: Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(long,lat, 115)),
scale: 3,
heightReference: Cesium.HeightReference.RELATIVE_TO_GROUND
}));
Cesium.when(model.readyPromise).then(function(model) {
model.activeAnimations.addAll({
loop: Cesium.ModelAnimationLoop.REPEAT
});
});
}
addModel(-7.0110, 53.2883);
I’ve highlighted the value I have to change to get the model to sit on the ground.
My understanding is that with the relative_to_ground reference set, it should ‘clamp’ the model to the ground, regardless of the terrain height, but I’m not seeing this behavior.
I’ve attached a picture that shows them rendered almost correctly, but they are still a bit ‘low’, i.e. the base of them is hidden.
I’ve also attached the model that I’ve used.
Is there someway to set a value that will always offset the model relative to the terrain?
Thanks for the help.
Thanks
WindTurbine.gltf (28.3 KB)