How to get the camera altitude?

How do I calculate the camera altitude? this.scene.getCamera().position.z is not correct even if I convert to cartographic.

You can use an ellipsoid to convert a position to a Cartographic3 which has a height property. To get the altitude of the camera position:

ellipsoid.toCartographic3(scene.getCamera().position).height

Thanks for the quick response Daniel. That is working for me now.