Camera

Several game objects and components that come with the ArcGIS Maps SDK for Unity plugin are essential for rendering and interacting with your ArcGIS scene.

A Camera component is used to set the data loading point for an ArcGIS scene. In order for the Camera to work, the Camera game object must have the ArcGIS Camera component and be a child of an ArcGIS Map game object.

ArcGIS Camera

You need to attach an ArcGIS Camera component to a game object with a Camera component to load tiles and scene nodes for the ArcGIS Map. When the camera moves, ArcGIS Map will set the view that will determine what tiles and scene nodes are streamed and rendered.

There are two settings for the play mode that are enabled by default on the ArcGIS Camera component:

  • Update Clipping Planes: This option adjusts the near and far planes of the Unity camera component every frame. The near and far planes are adjusted based on the altitude of the camera game object in geographic space; the higher the game object, the further the camera will render.
  • Use Camera Viewport Properties: This option allows you to manually adjust the size of the viewport of the ArcGIS Camera component when this option is disabled. This allows you to have more control over what is rendered during a frame update. When this option is enabled, the ArcGIS Camera component will use the Unity camera component's viewport settings.

An ArcGIS Location component must to be attached with the ArcGIS Camera component on the same game object to place it with geographic coordinates. This allows the ArcGIS Camera and its game object to be accurately positioned in the ArcGIS scene. For more information about the ArcGIS Location component, see the location component topic.

The ArcGIS Location component transforms Unity coordinates into GIS coordinates and defines the position. The ArcGIS Camera defines the tilt and heading of the point from which the scene is observed.

Values for camera

  • X (Longitude) : Specifies the east–west position of a point on the Earth's surface. A projected position value for projected coordinate systems or a longitude value for geographic coordinate systems.
  • Y (Latitude) : Specifies the north–south position of a point on the Earth's surface. A projected position value for projected coordinate systems or a latitude value for geographic coordinate systems.
  • Z (Altitude) : The vertical distance of the camera above the terrain.
  • Spatial Reference WKID : The spatial reference of the X, Y and Z values in Well-Known ID (WKID).
  • Heading: Provides the ability to either get or set the map view rotation value. This is also known as yaw or azimuth. It represents the number of degrees by which the map's data will be rotated, measured counterclockwise from the north. To rotate clockwise, use a negative value.
  • Pitch: Provides the ability to either get or set a map view's pitch. Pitch is the equivalent of moving a plane's nose up or down (rotating along the axis that passes through the plane's wings). Positive values, looking forward, are above the horizon (pointing upward) and negative values are below the horizon (pointing downward).
  • Roll: Provides the ability to either get or set a map view's roll. Roll is the equivalent of tilting a plane's wings up or down (rotating along the axis that passes through the center of the plane from front to back). A zero value is perfectly horizontal. Positive values will tilt the left side upward (or right side downward). Negative values do the opposite.

To set up an ArcGIS Camera:

You can create an ArcGIS Camera from the Map Creator Camera tab.

  1. Click on the Camera tab.
  2. Fill in the values for the camera position and rotation.
  3. Click on the Create Camera button.

When you create a camera with this feature, it will be parented to the ArcGIS Map in the Hierarchy window. If you have a camera in the scene that is tagged as MainCamera, it will be parented to the ArcGIS Map and ArcGIS Camera and ArcGIS Location components will be added to it.

If you find a better camera angle while you navigate around in the Editor mode, click on the Align with View to update the initial camera position for the Play mode.

If you want to control the camera during Play mode, attach an ArcGIS Camera Controller component to the camera game object. The ArcGIS Camera Controller component can be found in the Assets/Samples/ArcGIS Maps SDK for Unity/1.0.0/All Samples/Components folder:

  1. Click on the ArcGISCamera in the Hierarchy window. If it is not visible, expand ArcGISMap.
  2. In the Inspector window, click on the Add Component button.
  3. Search for ArcGIS Camera Controller component and attach it to the camera.

Set a fixed data loading point

It is not a requirement to attach an ArcGIS Camera component to your active camera. In some cases you may want to use an ArcGIS Camera as a fixed loading point to only bring in a set LOD (level of detail) into your scene. You can attach the ArcGIS Camera component and an ArcGIS Location component to an empty game object, then set the position of the game object through the ArcGIS Location component.

Camera controller

ArcGIS Maps SDK for Unity comes with a sample ArcGIS Camera Controller component that you can use in your ArcGIS scenes. This component correctly wraps and moves around the Earth in both global and local scenes, and it is controlled by using the WASD keys and mouse during runtime. This component is meant to be a sample that demonstrates how you can move the camera. If you want to change how the camera moves, update this script or write your own script, and attach it to your camera.

Rebasing

The ArcGIS Rebase component is responsible for periodically updating the world's origin position as the camera moves around. Unity uses 32 bit floating point precision, which isn't precise enough to cover the whole world.

To enable the same behavior during Editor mode, enable the Rebase In Scene View option in the ArcGIS Map component.

Camera in the Editor mode

When Editor mode is enabled, the ArcGIS Camera loads data according to its position and displays it in the Scene view. It will load better LODs for areas closer to the view and lower LODs for the areas that are further away.

Whether you create an ArcGIS Map with the Map Creator UI or by manually adding components, the Data Fetch Using Scene Camera is enabled by default and the Rebase In Scene View option is disabled in the ArcGIS Map component.

The Data Fetch Using Scene Camera option allows the loading of LOD data according to the Scene View camera instead of ArcGIS Camera. When you have multiple cameras in your scene and want to use the ArcGIS Camera as a fixed data loading point in the Editor mode, disable the option to not load different LODs according to the Scene View camera position.

When the Rebase In Scene View option is enabled, the Origin position will be periodically updated while you navigate the scene. This option is useful when you explore larger areas during Editor mode.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.