Hi, I’m trying to retrieve a lat/lon and height of where I have clicked on the generated map in Cesium.
Typically, I’d use physics ray cast to fire a ray to hit something, but this is just going to hit a unity world-space position. I need to know the Lat/Lon/elevation of where I clicked on the terrain.
Bing maps had something similar where I could click on the map and it would return the lat/lon/elevation of where I clicked.
Is this possible as I use it to calculate distances between a point a user has clicked and another point?
Yep. Do your raycast. Then feed the Unity position into the TransformUnityPositionToEarthCenteredEarthFixed method on the CesiumGeoreference component, to get an ECEF position:
Then pass that to the static EarthCenteredEarthFixedToLongitudeLatitudeHeight method on CesiumWgs84Ellipsoid to get the longitude/latitude/height (in that order!):
is there a conversion in cesium for Unity to convert that to an elevation above sea level or would we need to calculate that ourselves? If ourselves, do you have a suggestion?
thank you