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. 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.

Two settings for the play mode 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 additional setting is used to control data quality:

  • Quality Scaling Factor: This option allows you to control the quality of the GIS content being rendered. A higher number indicates higher quality and a higher impact on performance. The default number is 2.

An ArcGIS Location component must be attached to 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 the 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 the Camera tab.
  2. Fill in the values for the camera position and rotation.
  3. Click the Create Camera button.

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

If you find a better camera angle while you navigate around in the Editor mode, click Align with View to update the initial camera position for 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/[version]/Sample Content/Components folder:

  1. Click ArcGISCamera in the Hierarchy window. If it is not visible, expand ArcGISMap.
  2. In the Inspector window, click 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 higher 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.

Render a video

In Unity, you create a video by using camera animation. Cinemachine from Unity is one tool for camera animations.

If you want to create a video in a small area and do not want the LODs to change, set a fixed data loading point and set the location to match the Cinemachine Virtual Camera.

If you are working with a larger area and need to change the LODs, you could attach the ArcGIS Camera component to your Cinemachine Virtual Camera. This way the scene can be rendered properly by synchronizing the movement of ArcGIS Camera with Cinemachine Virtual Camera. See below for an example setup:

camera_animation

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