Is there a way to compute the distance (in miles, feet, etc) between an entity and the camera?

Hi,

I want to calculate the distance between the _viewer.trackedEntity and the _viewer.camera in feet, or meters, miles. Is this something built-in in Cesium?

Thanks,

Lionel

Hello

This will give you the distance in meters:

    var position = entity.position.getValue(viewer.clock.currentTime);
    var distance = Cesium.Cartesian3.magnitude(Cesium.Cartesian3.subtract(scene.camera.position, position, new Cesium.Cartesian3()));

``

Best,

Hannah

Thank you Hannah.