Important items to note

With different project types, you will have prefabs that will automatically be added to the active scene. In this section, we will go over the main object that is added to any template type, which is the Map object.

The Map is the most important object that is added to with any of our templates and has many extremely important items within the script that we should go over:

The first item within the Map object is the Abstract Map script. The most important items within are MAP LAYERS, GENERAL, Location, and Others:

Within the GENERAL tab, we have:

  • Latitude Longitude: If you click on Search, you can set this by typing in an address, or country and city, or even city and state, depending on the location you want to utilize. It will automatically convert it to be latitude and longitude values.
  • Zoom: This is specifically set for how close and far away the map can be drawn; be advised that the zoom function will only work appropriately if you have the proper tilesets generated for it.
  • Extent Options: These are how far you want the map to be drawn. By default, it is set to the bounds of the camera.
  • Camera: This is the camera you want to use, whether it is an AR camera with Vuforia, ARCore, ARKit, or even the regular Unity camera.
  • Update Interval: This is how long the program should wait before updating positions and drawing.
  • Initialize On Start: This is a Boolean value for whether or not you want the map to immediately be drawn upon the start of the scene:

In the Others tab, we have a few options as well:

  • Placement Options allows you to choose between At Location Center and At Tile Center. This controls the center or root placement of the tiles. Location center is able to be defined by you, whereas the tile center is the center of the tile.
  • Snap Map To Zero is a Boolean value that specifies whether or not the map’s root should be snapped to 0,0,0.
  • Scaling Options allows you to choose whether you want a custom or world scale. Custom is defined by Unity using a Mercator conversion factor. World scale means that the actual scale is rendered and the Mercator conversion is ignored.
  • Unity Tile Size is the size of the tiles used in Unity units.
  • Loading Texture is the texture used when the textures are loading.

The next tab is the IMAGE tab:

  • Data Source: This is the source of our maps. We can use Mapbox Streets, Mapbox Outdoors, Mapbox Dark, Mapbox Light, Mapbox Satellite, Mapbox Satellite Street, Custom, or None. These are essentially theme options for the map you want to use.
  • Use Retina: This is a Boolean that allows you to choose whether you want to enable the usage of larger texture maps and better visual quality for retina displays.
  • Use Compression: This is a Boolean that allows you to choose to use Unity compression for the tile texture.
  • Use Mip Map: This is a Boolean that lets you choose whether to use Unity-generated mip mapping.

The next tab is TERRAIN, which gives us the ability to modify the terrain of our Mapbox maps:

  • Data Source: This is the first option available, and it lets us choose between using Mapbox Terrain, Custom, or None. Mapbox Terrain provides us with digital elevation with worldwide coverage. Custom allows us to use a custom elevation model. None is a flat terrain.
  • Map Id: This is the Id of the corresponding tileset that we want to use.
  • Elevation Layer Type: This gives us the choice between Flat Terrain, Terrain with Elevation, Low Polygon Terrain, and Globe Terrain. This allows us to render our terrain with the specified elevation type. Flat Terrain renders a flat terrain with no elevation. Terrain with Elevation renders terrain with elevation from the source specified. Low Polygon Terrain renders a low polygon terrain with elevation from the source specified. Globe Terrain renders a terrain with no elevation for a globe.
  • Base Material: This is the material used to render the terrain tiles.
  • Exaggeration Factor: This multiplies the factor to vertically exaggerate elevation on the terrain, however, it does not work with the Flat Terrain Elevation Layer Type.
  • Add Collider: This is a Boolean that lets us add Unity physics colliders to terrain tiles for detecting collisions.

The Others tab within the TERRAIN tab has a few options available to us as well:

  • Sample Count: This gives us the resolution for our terrain, with the result being an n x n grid.
  • Use Relative Height: This is a Boolean that lets us use a world-relative scale for scaling the terrain height.
  • Earth Radius: This is the radius of the Earth we want to use in Unity units of measurements, which is meters.
  • Show Sidewalls: This is a Boolean that adds side walls to terrain meshes, which reduces visual artifacts.
  • Add to Unity layer: This adds the terrain tiles to the Unity layer. Upon checking the checkbox, you will get the choice of which layer you want to add them to—Default, TransparentFX, Ignore Raycast, Water, UI, Postprocessing, and Add Layer.

Next is the MAP LAYERS tab:

  • Data Source: This is the source dataset for the vector data.
  • Map Id: This is the Id of the map we are using.
  • Use Optimized Style: This is a Boolean that allows us to use Mapbox-style-optimized tilesets that remove any layers or features in the tile that are not represented by a Mapbox style. Style-optimized vector tiles are smaller, serve over the wire, and are a great way to reduce the size of offline caches.
  • Enable Coroutines: This is a Boolean that allows us to use coroutines.
  • Entity Per Coroutine: This specifies how many entities can be grouped together in a single coroutine call.

POINTS OF INTEREST is the next tab. Here you can create special markers for important locations in your application or game:

  • Required Map Id: This is the map Id of the tileset we are using and cannot be empty.
  • Add Layer: This allows us to add points of interest layers.
  • Remove Selected: This allows us to delete a layer.

The last tab is FEATURES, which gives us Vector Layer Visualizers with the options to add or remove visualizers. FEATURES allow us to modify how certain features look in relation to the point of interest we create:

  • Add Visualizer: This allows us to change how we visualize a points of interest layer
  • Remove Selected: This allows us to delete the selected visualizer

Finally, we have another script, called Initialize Map With Location Provider, which only has the option to add an Abstract Map object to it. This script does what the name states—it registers if you are on an iOS, Windows, or Android device, and selects the Location Provider that is most relevant for it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.134.102.182