First, I want to thank the Cesium development team for bringing 3D geospatial to Unity.
Secondly, I’ve been following the Cesium for Unity tutorials. I was able to display the globe and show Melbourne Photogrammetry on the 3D map. Very cool! However, how do I add two drones at two locations, one in New York City and one in downtown Chicago, IL? I tried adding two cubes but their positions were in x,y,z in Unity unit.
If I use CesiumJS, all I have to do is just add the two drones as two entity models and I can specify the lat, long, alt for each drone.
Thanks in advance!
You can put an object in a specified longitude/latitude/height location by adding the CesiumGlobeAnchor component to it. It’s covered in the “Placing Objects on the Globe” tutorial:
Since you’re working in two different cities, you may also want to check out the CesiumSubScene component. The idea is to place two sub-scenes, one in each city, and make the objects in each city children of the sub-scene. We’ll have a full tutorial for this soon.
@Kevin_Ring Thanks for the quick reply. I did it I followed that tutorial and was able to put the drones in NYC and Chicago.
However, it was so difficult to navigate in the Unity Editor between NYC and Chicago to put the GameObjects. Double-clicking the game objects between the two cities did not bring me to their locations. I had to change the Lat, Long, Alt of CesiumGeoreference component every time to jump from one city to another. I wish there is a flyTo function like in CesiumJS and its beautiful fly animation. I am looking forward to using the CesiumSubScene so I could move to different locations quickly.
Other than that, I like it a lot and Cesium for Unity has a lot of potential. Thanks again for your help!
Yeah Unity has a weird limitation where it refuses to zoom the editor camera to objects that are too far away. Moving the Georeference is a good workaround, and will give you better in-editor rendering precision and control, too. Using the CesiumSubScene components will make this easier - basically you can jump between different locations on the globe just by activating the appropriate sub-scene (and all others will be automatically deactivated).
For in-game use (not so much the Editor), we’re in the process of adding a globe aware camera controller that also knows how to fly between locations on the globe with a nice animation. I don’t have a firm release date for that, but it should definitely be within the next month or two.
I am currently working on a similar project. It appears that I need to use the origin shifting feature to switch between cities, as they are quite far from each other. Without this feature, the game object may be placed very far from the original position of Unity. Enabling the origin shifting feature means that the camera will always be placed in the original position of Unity, and the Cesium map will move when trying to move the camera.
To make it easier to control the “Lat, Lon, Height” inside the “Cesium Globe Anchor” script, which is a component of the camera, you should be able to fly to anywhere you want with any path. For example, you can increase the height first, then go to the target Lat/Lon, and then reduce the height again.
I hope this helps.