stopping the behavior of the camera looking down for Camera.flyTo() function.

Hi

I am using Cesium 1.6 camera.flyTo api for flying to the destination selected by the user. When using flyTo api camera is looking down and then applying the orientation.
Below is the code i used.

camera.flyTo({
  destination : globalCesium.Cartesian3.fromDegrees(long, lat, height),
  orientation : {
  heading : globalCesium.Math.toRadians(parseFloat(headingdegrees)),
  pitch : globalCesium.Math.toRadians(0.0), // (looking straight)
  roll : 0.0, // default value
  }
});

Is there is anyway to avoid/change the default behavior of the camera from looking down for flyTo api?

Please suggest if any solution for this?

Thanks
Frederic Anand

Hi,

I already asked the same question (If I understand you correctly). As the result, I’ve made own flyTo animation using linear interpolation of camera Cartographic position and its Up vector between start and end values over time. It was a bit better for me but not very good too.

Seems to me good solution for such camera transfer is not obvious, it needs more complicated algorithms and also experimenting with their parameters. It’s rather labourious.

Alexei

Some thoughts on what might make a good flight.

Flight orientation:

The majority of the flight should have the camera looking at the destination, even if that means looking through the Earth if it’s beyond the horizon. Perhaps use roll 0 during the flight. Only during the last second or so should it start to turn toward the final orientation.

Flight position

You should be able to declare: flight_time, cruising_altitude, and cruise_ratio. (cruise_ratio 0.8 would mean 80% of the time is spent cruising) Though if you don’t want to bother setting those it could calculate some good defaults for you. Such as setting cruising_altitude based on distance traveled.

The Flight

latitude_speed = latitude_difference / flight_time

longitude_speed = longitude_difference / flight_time

cruise_time = cruise_ratio * flight_time

vert_time = flight_time - cruise_time

//Takeoff: from 0 to (vert_time/2)

vertical_takeoff_speed = (cruise_altitude-initial_altitude) / (vert_time/2)

//Landing: from (flight_time - vert_time/2) to flight_time

vertical_descent_speed = (cruise_altitude-final_altitude) / (vert_time/2)