Hello everyone,
I am just starting to work with Unity and Cesium for the very first time. I am writing a C# script that is supposed to receive some longitude and latitude coordinates, convert them to world coordinates, and add place some spheres on the globe at these coordinates. I could not find anything about this issue. Could you please let me know how to go about this? Thank you all in advance.
First, I recommend attaching a CesiumGlobeAnchor component to each sphere. The component will keep track of the globe-relative position of the object (in long / lat coordinates), and it automatically updates the Unity position to keep track of this. You can learn more about Cesium Globe Anchor by following this tutorial!
However, if you would prefer to place the objects manually, then you can check out the following functions. First, you’ll have to call CesiumWgs84Ellipsoid.LongitudeLatitudeHeightToEarthCenteredEarthFixed to convert to ECEF coordinates.
Then, given those ECEF coordinates, you’ll want to call TransformEarthCenteredEarthFixedPositionToUnity on the CesiumGeoreference.
I hope that helps! Let us know if you have any follow-up questions.