SpacesApi (Class)
Namespace: Wrld.Space
Contains functionality for working with object transforms and positions in various coordinate systems.
Methods
float GetAltitudeAtLatLng (LatLong latLong)
Obtain the altitude of the terrain above sea level at the specified LatLong point.
Returns: Terrain altitude.
Argument | Type | Description |
---|---|---|
latLong | LatLong | A LatLong point. |
DoubleRay ScreenPointToRay (Vector2 screenPoint)
Obtain a ray in ECEF coordinates from the current camera location and passing through the specified screen point.
Returns: An ECEF ray.
Argument | Type | Description |
---|---|---|
screenPoint | Vector2 | The screen point, in pixels, with screen origin bottom-left. |
DoubleRay LatLongToVerticallyDownRay (LatLong latLong)
Obtain a ray in ECEF coordinates in a vertically downwards direction, and starting at a point high above the Earth’s surface at the specified LatLong point.
Returns: An ECEF ray.
Argument | Type | Description |
---|---|---|
latLong | LatLong | A LatLong point through which the vertical ray passes. |
Vector3 GeographicToWorldPoint (LatLongAltitude position)
Transforms a point from a LatLongAltitude to a Unity transform position. Note: If using the ECEF coordinate system, the returned position will only be valid until the camera is moved. To robustly position an object on the map, use the GeographicTransform component.
Returns: The transformed geographic LatLongAltitude in local space.
Argument | Type | Description |
---|---|---|
position | LatLongAltitude | The geographical coordinates of the position to transform to local space. |
LatLongAltitude WorldToGeographicPoint (Vector3 position)
Transforms a point from a Unity transform position to a LatLongAltitude. Note: If using the ECEF coordinate system, the returned position will only be valid until the camera is moved. To robustly position an object on the map, use the GeographicTransform component.
Returns: The transformed world position as a LatLongAltitude.
Argument | Type | Description |
---|---|---|
position | Vector3 | The world position to transform into a geographic coordinate. |
double HeadingDegreesFromDirectionAtPoint (DoubleVector3 directionEcef, DoubleVector3 pointEcef)
Calculates the absolute heading angle of a direction at a geographic coordinate.
Returns: The absolute heading angle in degrees clockwise from North of directionEcef at pointEcef.
Argument | Type | Description |
---|---|---|
directionEcef | DoubleVector3 | A unit direction vector in ECEF coordinates. |
pointEcef | DoubleVector3 | A point in ECEF coordinates. |