In the following code I attempt to have 50 models in a row.
Even though the height is set as 0 the farther down the line
the higher in the air the models are placed.
Apparently there is something I don't understand happening here.
How do I get all the models to be placed on the ground?
var viewer = new Cesium.Viewer('cesiumContainer', {
infoBox : false,
selectionIndicator : false,
shadows : true
});
function createModel2(url, height,coord) {
var position = Cesium.Cartesian3.fromDegrees(-123.0744619, coord, height);
var heading = Cesium.Math.toRadians(135);
var pitch = 0;
var roll = 80.100;
var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr);
var entity = viewer.entities.add({
name : url,
position : position,
orientation : orientation,
model : {
uri : url,
minimumPixelSize : 128,
maximumScale : 20000
}
});
viewer.trackedEntity = entity;
}
var coord = 44.0503706;
var increment = 1;
var options = [{
text : 'Aircraft',
onselect : function() {
for (var i = 1; i <= 50; ++i) {
increment =Number((i / 2000000).toFixed(6));
coord = coord + increment;
createModel2('../../SampleData/models/ship/ship4.gltf', 0,coord);
}}
}];
Sandcastle.addToolbarMenu(options);