There are a few things I noticed. You are calling Cartesian3.fromRadians with latitude before longitude, but it should be the other way around. The bounding sphere could be a more reasonable size, or just don’t pass one in at all, it will be generated automatically based on the instance positions. I removed the timeout and worked directly with promises - I’m adding it to scene.primitives before it’s ready, but this needs to be done to load the collection. shadowMode is not a valid option for ModelInstanceCollection right now. If you want to disable shadows entirely, make sure that viewer.shadows is false.
Here’s a working demo that I created around your sample code. Let me know how it goes.
var viewer = new Cesium.Viewer(‘cesiumContainer’);
var terrainProvider = new Cesium.CesiumTerrainProvider({
url : 'https://assets.agi.com/stk-terrain/world',
requestWaterMask : true,
requestVertexNormals : true
});
viewer.terrainProvider = terrainProvider;
var centerLongitude = -1.31968;
var centerLatitude = 0.698874;
var center = Cesium.Cartesian3.fromRadians(centerLongitude, centerLatitude);
viewer.camera.lookAt(center, new Cesium.HeadingPitchRange(0.0, -0.35, 500));
var locations = new Array(10);
for (var i = 0; i < 10; ++i) {
var longitude = centerLongitude + Math.random() * 0.00001;
var latitude = centerLatitude + Math.random() * 0.00001;
locations[i] = new Cesium.Cartographic(longitude, latitude);
}
Cesium.sampleTerrain(viewer.terrainProvider, 11, locations).then(function(updatedPositions) {
var primitiveCollection = placeTrees(updatedPositions);
viewer.scene.primitives.add(primitiveCollection);
primitiveCollection.readyPromise.then(function() {
console.log('Ready');
});
});
function placeTrees(locations) {
var scale = new Cesium.Cartesian3(1, 1, 1);
var treeInstances = [];
locations.forEach(function (location) {
var cartesianPosition = Cesium.Cartesian3.fromRadians(location.longitude, location.latitude, location.height);
var modMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(cartesianPosition);
treeInstances.push({modelMatrix: modMatrix});
});
var primitives = new Cesium.ModelInstanceCollection({
instances: treeInstances,
url: "../../SampleData/Models/CesiumAir/Cesium_Air.gltf",
allowPicking: false
});
return primitives;
}