cesium
cesium copied to clipboard
Weird interaction between CzmlDataSource.process and tracked entity
Reported on the forum: https://groups.google.com/forum/?hl=en#!topic/cesium-dev/fILh9nJyI1w
The model in this example looks like its flickering. To me it looks like it might be that the camera isn't tracking it correctly for a split second after the model moves. This only happens when czmlDataSource.process
is called.
var viewer = new Cesium.Viewer('cesiumContainer');
var czmlDataSource = new Cesium.CzmlDataSource();
viewer.dataSources.add(czmlDataSource);
var czmlString = '[\
{\
"id":"document",\
"version":"1.0",\
"clock":{\
"multiplier":1,\
"range":"UNBOUNDED",\
"step":"SYSTEM_CLOCK",\
"interval":"0001-01-01T00:00:00Z/9999-12-31T23:59:59.999Z",\
"currentTime":"2016-11-15T00:15:53.63100000000122Z"\
}\
},\
{\
"availability":"0001-01-01T00:00:00Z/9999-12-31T23:59:59.999Z",\
"id":"LineToTarget",\
"polyline":{\
"width":3,\
"positions":{\
"cartographicDegrees":[\
-118.2437,34.0522,20000,-122.4194,37.7749,100\
]\
},\
"material":{\
"solidColor":{\
"color":{\
"rgba":[\
255,0,0,255\
]\
}\
}\
}\
}\
}]';
var czml = JSON.parse(czmlString);
czmlDataSource.process(czml);
var position = Cesium.Cartesian3.fromDegrees(-118.2437,34.0522,20000);
var heading = Cesium.Math.toRadians(135);
var pitch = 0;
var roll = 0;
var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr);
var url = '../../SampleData/models/CesiumAir/Cesium_Air.glb';
var entity = viewer.entities.add({
name : url,
position : new Cesium.CallbackProperty(function() {return position;}, false),
orientation : orientation,
model : {
uri : url,
minimumPixelSize : 128,
maximumScale : 20000
}
});
var i = 0;
viewer.trackedEntity = entity;
setInterval (function () {
position = Cesium.Cartesian3.fromDegrees(-118.2437+i,34.0522,20000);
i += 0.001;
}, 2000);
setInterval(function () {
czmlDataSource.process(czml);
}, 1000);