Hello!
I have a flight simulator with a view from the cockpit.
Which is the best way to update the camera view?
Thank You!
var flight = {
pitch: 0,
roll: 0,
heading: 80,
altitude: 0,
latitude: 24.700590,
longitude: 42.288961,
speed: 0,
Wz: 0, //angular velocity around Z-axis of the airplane
Wx: 0, //angular velocity around X-axis of the airplane
Wy: 0 //angular velocity around Y-axis of the airplane
//...
};
//initialise the view
viewer.scene.camera.setView({
destination : Cesium.Cartesian3.fromDegrees(flight.latitude, flight.longitude, flight.altitude),
orientation : {
heading : Cesium.Math.toRadians(flight.heading),
pitch : Cesium.Math.toRadians(flight.pitch),
roll : Cesium.Math.toRadians(flight.roll)
}
});
var interval = setInterval(updateFlight, 25);
function updateFlight() {
updatePitch();
updateRoll();
//...
//update all flight properties
}