About Unity coordinates to longitude and latitude coordinates

  1. If I want to add an object to the scene based on its latitude and longitude, how do I set its height so that it looks like it’s on the ground in Cesium, because it’s not close to the ground when the height is set to 0

2、2. How to flexibly carry out Unity coordinates and turn Cesium longitude and latitude coordinates in the code? Can we only use CesiumGlobeAnchor script?

  1. You will need to find the height of the ground at that point. Physics.Linecast should help.
  2. You can use methods on the CesiumGeoreference to convert between ECEF and Unity coordinates. You can use static methods on CesiumWgs84Ellipsoid to convert ECEF coordinates to longitude/latitude/height. We don’t have separate documentation for these methods yet, but if you open the script source files included with the plugin you will find detailed comments.

Thank you for your answer,But I don’t care about ECEF coordinates, I only care about the conversion between latitude and longitude coordinates and Unity coordinates, is this only by mounting CesiumGlobeAnchor script to convert, is there any other way, because the project used Arcgis For Unity before, It has a global static method for transformation

You currently have no option but to go through ECEF coordinates. It’s not too hard, though. Something like:

CesiumGeoreference georeference = GetComponentInParent<CesiumGeoreference>();
double3 ecef = georeference.TransformUnityPositionToEarthCenteredEarthFixed(unityCoordinates);
double3 lonLatHeight = CesiumWgs84Ellipsoid.EarthCenteredEarthFixedToLongitudeLatitudeHeight(ecef);
double longitude = lonLatHeight.x;
double latitude = lonLatHeight.y;
double height = lonLatHeight.z;

Ok, thanks a lot

There is another question that I want to clarify. If I want to access the trajectory information of vehicles on the road through WebSocket in the scene, and the information of each vehicle includes the latitude and longitude, at this time, I need to let each vehicle run on the ground. At this time, can I only get the point of the ground by downward ray detection first? look forward to your reply,thankyou

Yeah, that’s currently the only way. Unless you can use Unity’s gravity system to do the work for you.

1 Like

Thank you for your answer, I also want to know, in the local area network (LAN) environment, I will not be able to online services via Cesium3DTileset connection, I can also through CesiumTileMapServiceRasterOverlay loading I published in the local area network (LAN) environment map service?In other words, does Cesium For Unity support LAN usage?

Sure, if all your data is coming from LAN sources, then it will work just fine.

I put the Cesium 3d Tileset script TilesetSource changed From the Url, I put the pictures of above CesiumTileMapServiceRasterOverlay Url, copy to the Cesium 3d Tileset Url, Unable to load the map at this time, Url: http://localhost:9003/image/tms/lVWHIBz8/tilemapresource.xml。Change the TilesetSource of Cesium 3D Tileset script to From Url. Does it mean that the URL of the LAN map service can be loaded?And the format of the URL is a service of the Terrain type? Is there any rule for URL service in LAN? Looking forward to your reply. Thank you

If I’m understanding you correctly, you’ve copied the TMS URL (http://localhost:9003/image/tms/lVWHIBz8/tilemapresource.xml) into the Cesium3DTileset URL field. Yeah, that won’t work. A TMS server isn’t a tileset. A TMS is only providing textures that can be draped over geometry. If you want to run disconnected from the internet, you also need the geometry / terrain / tileset to be available on the LAN.

Do you have tools or software to deploy and release geometry/terrain/tileset, or some documentation, thank you

You can upload source data to Cesium ion to be tiled. For data in 3D Tiles format (e.g., photogrammetry), you can then download it for offline use. Unfortunately that’s not yet possible for terrain data (e.g., created from a heightmap), so for that you’ll need the offline tilers. You can read more about those here: