Google.Maps.Coord.Projection

Projection between latitude/longitude and Unity worldspace.

Summary

Caution: You must set the floating origin before using the Coordinate System. For more information, see the MapsService.InitFloatingOrigin method.

Public attributes

Zoom
int
The zoom level.

Properties

IsFloatingOriginSet
bool
Whether FloatingOrigin has been set.

Public functions

FromLatLngToVector3(LatLng latLng)
Vector3
Converts a LatLng value into a Unity Worldspace Vector3 by way of the Spherical Mercator projection:
FromVector3ToLatLng(Vector3 vector3)
Converts a Unity Worldspace Vector3 into a LatLng, by way of the Spherical Mercator projection.

Public attributes

Zoom

int Zoom

The zoom level.

Properties

IsFloatingOriginSet

bool IsFloatingOriginSet

Whether FloatingOrigin has been set.

Public functions

FromLatLngToVector3

Vector3 FromLatLngToVector3(
  LatLng latLng
)

Converts a LatLng value into a Unity Worldspace Vector3 by way of the Spherical Mercator projection:

  • translated relative to the current origin (FloatingOrigin).
  • scaled relative to the latitude of the initial floating origin (MercatorScale).

Details
Parameters
latLng
The LatLng value to convert.
Returns
A Vector3 value in Unity Worldspace.

FromVector3ToLatLng

LatLng FromVector3ToLatLng(
  Vector3 vector3
)

Converts a Unity Worldspace Vector3 into a LatLng, by way of the Spherical Mercator projection.

This method is the inverse of the FromLatLngToVector3 method. It takes into account the fact that the Vector3 has been translated relative to the current origin, and scaled relative to the latitude of the initial origin.

Details
Parameters
vector3
The Vector3 value to convert.
Returns
The converted LatLng value.