The ArcGIS Location Component is used to place a Game
at specific geographic coordinates and define its relation to the surface. This component is integrated with Unity's high-precision framework and helps the Game
transform its location to geographic coordinates. For example, you can use the ArcGIS Location Component to place a 3D model of the Eiffel Tower with an accurate geographic position and rotation and define its altitude.
High-Precision Framework
ArcGIS Maps SDK for Unity has native geospatial placement that uses the high-precision framework, that was developed by Unity and integrated within the ArcGIS Maps SDK for Unity. The high-precision framework allows Unity to render very large worlds and addresses many of the limitations of working with 32-bit floating point precision.
When you create an ArcGIS Map, the HPRoot component is automatically added to set the Origin position. The HPTransform component must be a child of HPRoot; it works with the ArcGIS Location component to convert double precision to 32-bit floating point precision. In a scene that uses the high-precision framework, HPTransform should be used instead of Transform. A Game
with an HPTransform cannot be a child of another HPTransform.
Use the ArcGIS Location component
To position your project's existing game objects in real world locations, you can add an ArcGIS Location component. You can search for it in the project folder.
If you are going to develop an app with the C# API, make sure game objects with the ArcGIS Location component are children of the game object that contains the ArcGIS MapView component.
If you select the Map Creator UI or components development option in order to use an ArcGIS Location component:
-
Click the game object in the Hierarchy window and click Add Component to select the ArcGIS Location component to add the script. For more information about components, see Unity's documentation: Use components.
-
Select the game object and set the initial position and rotation of the game object in the Inspector.
- X (Longitude) : Specifies the east–west position of the game object 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 the game object on the Earth's surface. A projected position value for projected coordinate systems or a latitude value for geographic coordinate systems.
- Z (Altitude): Sets the vertical distance of the game object above the Earth. The units depend on the spatial reference.
- Spatial Reference WKID: Well-Known ID (WKID) of the spatial reference for the X, Y, and Z values. Note that specifying the spatial reference with Well-Known Text (WKT) is not supported for the ArcGIS Location Component.
- Heading: Sets the heading or up axis of the game object. This is also known as yaw or azimuth. It represents the number of degrees by which the game object will be rotated, measured counterclockwise from north. To rotate clockwise, use a negative value.
- Pitch: Sets the pitch or right axis of the game object. 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: Sets the roll or forward axis of the game object. 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.
-
Select a surface placement mode to determine the positioning of the game object in relation to the ground in the Surface Placement section.
Surface Placement
Using the ArcGIS Location Component, you can accurately position a Game
on the surface, ensuring it interacts correctly with the topography. For a specific XY position, altitude may vary depending on the elevation source, the LOD, and so forth. Surface Placement is used to place objects relative to the ground and ensure the object's altitude is always set correctly.
In the Surface Placement section, you can select between different elevation modes to define how the Game
is positioned relative to the ground and the relative offset, if applicable.
Surface Placement Modes:
- On the ground : Drapes the
Game
onto the ground. Ignores the z-value of the position.Object - Absolute height : Positions the
Game
vertically based on the z-value of the position.Object - Relative to the ground : Positions the
Game
aligned to the ground elevation. If there is a value set in the Surface Placement Offset, it is added to the ground elevation.Object
To set up the Surface Placement:
You can change the Surface Placement Mode from the inspector window.
- Click the
Game
that has the ArcGIS Location Component attached in the Hierarchy window.Object - In the Inspector window, expand the ArcGIS Location Component, then the Surface Placement section.
- Select the elevation mode from the Surface Placement Modes drop-down.