I have my flight sim model that I’m feeding into Cesium. As you can see below I’m then calling camera.setView() every 200ms. However this is terribly slow, both the frame rate and the actual render in Chrome and in IE. Is there a way to speed this up, maybe use camera.move() instead? Or shall I try with requestAnimationFrame instead of setInterval? Something has to be possible
var cameraInterval = setInterval(updateCamera, 200);
function updateCamera(){
var lat = flightModel.latitude;
var lon = flightModel.longitude;
var height = ModelContainer.acm.airdata.altitude;
var heading = flightModel.trueHeading;
var pitch = flightModel.pitch;
var roll = flightModel.roll;
var initialPosition = new Cesium.Cartesian3.fromDegrees(lon, lat, height);
var initialOrientation = new Cesium.HeadingPitchRoll.fromDegrees(heading, pitch, roll);
var camView = {
destination : initialPosition,
orientation : {
heading : initialOrientation.heading,
pitch : initialOrientation.pitch,
roll : initialOrientation.roll
}
};
// Set the initial view
viewer.scene.camera.setView(camView );
}