How to get the distance from the center of the local frame

1. A concise explanation of the problem you’re experiencing.

Hello I should fly on the map preserving the heading, pitch and range from user interaction.

I can get actual pitch and heading, but I don’t know how to get the actual range

can you help me?


2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

function flyMapToPin(){

heading = mapCamera.heading;

pitch = mapCamera.pitch;

range = 764.534479411941; // Here I should get the actual range

viewer.flyTo(pin, {

offset: new Cesium.HeadingPitchRange(heading, pitch, range)



3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

To keep the same distance

4. The Cesium version you’re using, your operating system and browser.


I think for this case it would be easier to: