var FOV = new Cesium.GeoJsonDataSource();
FOV.load("fov.json").then(function () {
var entities = FOV.entities.values;
for (var i = 0; i < entities.length; i++) {
var entity = entities[i];
entity.billboard = undefined;
entity.addProperty('customSensor');
entity.customSensor = new CesiumSensorVolumes.CustomSensorVolume();
directions = [];
for (var i = 0; i < 360; ++i) {
var clock = Cesium.Math.toRadians(1.0 * i);
var cone = Cesium.Math.toRadians(entity.properties.half-width); //half-width angle of the cone
directions.push(new Cesium.Spherical(clock, cone));
}
entity.customSensor.modelMatrix = getModelMatrix(lon = entity.properties.LON, lat = entity.properties.LAT, alt = entity.properties.HEIGHT * 1000);
entity.customSensor.radius = 10000000.0;
entity.customSensor.directions = directions;
entity.customSensor.intersectionColor = new Cesium.ConstantProperty(new Cesium.Color(0.1, 0.2, 0.3, 0.4)); //red
//viewer.scene.primitives.add(entity.customSensor); //uncommenting this makes it display, but I want it as part of the entity if poss
}
});
viewer.dataSources.add(FOV2)