Using your own camera controls
When using Wrld maps with the UnityWorld coordinate system it should be possible to use standard approaches to Unity camera control to explore. Alternatively, if built-in camera controls would be more helpful, see Using the Built-in Camera Controls.
When controlling your own camera, we recommend that you start the API with the UnityWorld coordinate system. This orients the map so that the local up direction for the point around which your map is based matches the unity Y axis. The choice of coordinate system is usually controlled from the Wrld Map behaviour via the Inspector window (see above), but you can also set this up in code yourself if you’re building your own behaviour, as shown below:
It is possible to control the camera in the alternative coordinate system (ECEF) but this requires you to take account of the curvature of Earth. As such it can get quite complicated, so we’d recommend using the built-in Wrld camera controller where ECEF is required. See Using the Built-in Camera Controls for an example.
Disabling the Built-in Camera Controls
Make sure the Use Built-in Camera Controls box is unchecked when using a custom camera, to avoid any risk of the built-in camera controls interfering. If you’re writing a your own behaviour and want to apply custom control to a camera you’ve previously passed to CameraApi.SetControlledCamera you’ll also need to call CameraApi.ClearControlledCamera to stop the built-in controls from taking effect.
You can select the starting latitude and longitude for which your scene will be loaded by modifying the Start Latitude and Start Longitude fields on the WrldMap behaviour. The latitude and longitude are expressed in decimal degrees, using the WGS84 standard (this is the same as the standard used by Google, Bing and many other mapping providers). If you’re writing a custom behaviour, you can instead set these fields in the Wrld.ConfigParams object that gets passed into Wrld.Api.Create:
Positioning the Camera
You can choose your camera’s starting position by moving it around in the editor as normal. Any scripts that modify the camera’s transform can be used to update its location.
The map is oriented such that any movement along the positive X axis corresponds to going east from the starting location on the globe and any movement along the positive z-axis corresponds to going north. Similarly, movement along the positive Y axis corresponds to an increase in altitude.
Streaming the map resources
If you’re using the WrldMap behaviour, streaming will be looked after automatically (the set of resources to be streamed is updated when the camera location changes). If you’re writing a custom behaviour, however, you will need to tell the API when the camera changes position. The relevant call is Api.StreamResourcesForCamera: