san
1
**How can i update height of a model dynamically by passing in meters. I’m able to update the height using **
entity.position = Cesium.Cartesian3.fromDegrees(-123.0744619,44.0503706,height);
``
****But i want pass only height.
I got another way like this by changing z
entity.position._value.z = entity.position._value.z + height ;
``
But it doesnt give the desired output.I want pass height in meters and want to pass only height.
What could be the correct way to achieve.
I provided a Sandcastle Link have a look at this and suggest me some Idea.
If you don’t want to provide the horizontal position to the callback, you’ll have to get it in the callback:
Cesium.knockout.getObservable(viewModel, ‘height’).subscribe(function(height) {
height = Number(height);
if (isNaN(height)) {
return;
}
var curPosXYZ = entity.position.getValue(viewer.clock.currentTime);
var curPosLLA = Cesium.Cartographic.fromCartesian(curPosXYZ);
entity.position = Cesium.Cartesian3.fromRadians(curPosLLA.longitude, curPosLLA.latitude, height);
});
``
Hope that helps.
Scott
san
3
Thanks Scott for the reply.It worked fine.