Skip to main content
Version: 3.7

World Positioning System (WPS)

What is WPS?

The Lightship World Positioning System (WPS) provides the 3D position and orientation of the phone in geographic coordinates as an alternative to using device GPS and compass heading data. WPS provides greater accuracy and frame-to-frame stability than standard GPS positioning, making it more suitable for AR applications. As the user moves around, WPS maintains the device's position, making it suitable for continuous use over long periods of time and long distances.

WPS will work in any location where the phone has a GPS signal, but the accuracy will vary depending on GPS accuracy.

Like all Lightship Experimental Features, WPS is unsupported and subject to change.

What can WPS be used for?

Any application that uses GPS locations or compass heading orientations can be improved by the increased accuracy and stability that WPS provides. There are also new types of AR experiences that combine WPS with existing geographic data, such as:

  • Creating a third-person view showing the accurate 3D position of the device a map
  • Using geographic data to augment the camera view or provide context for procedural generation
  • Replacing the map data with a virtual world that mirrors real-world topology which a player can explore by walking around.

To see some of the WPS use cases in action, try out the Sample Project.

The improvements to stability granted by world positioning can be seen side by side with the device compass in the below image.

Side-by-Side showing world positioning against the device compass

Enabling the World Positioning System

Adding the ['ARWorldPositioningManager'] to the XROrigin component in the Heirarchy will enable the World Positioning System in your project. This will automatically add an ['ARWorldPositioningCameraHelper'] to the MainCamera. For applications requiring the more accurate compass and GPS properties provided by WPS, these can be accessed directly from the CameraHelper.

Adding the World Positioning System UPM to your Project

To add the WPS UPM to your project, download the World Positioning System UPM from the Lightship Github.

The World Positioning Manager viewed in the Inspector.
Click to reveal WPSCompass.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Niantic.Experimental.Lightship.AR.WorldPositioning;

public class WPSCompass : MonoBehaviour
{
[SerializeField] private ARCameraManager _arCameraManager;

private ARWorldPositioningCameraHelper _WPSCameraHelper;

// Start is called before the first frame update
void Start()
{
_WPSCameraHelper = _arCameraManager.GetComponent<ARWorldPositioningCameraHelper>();
}

// Update is called once per frame
void Update()
{
float heading = _WPSCameraHelper.TrueHeading;
Quaternion rotation = Quaternion.Euler(0, 0, heading);

double latitute = _WPSCameraHelper.Latitude;
double longitude = _WPSCameraHelper.Longitude;
}
}

For placing objects anchored to World coordinates using the World Positioning System, please see the How-To page How to Build an App Using the World Positioning System (WPS).

How does WPS work?

WPS combines GPS, compass heading, and ARKit/ARCore tracking data from the session to produce a more accurate result. WPS requires the camera to be enabled for the ARKit/ARCore tracking, but the camera view doesn’t need to be visible to the user.

WPS FAQ

Why use WPS instead of the device GPS and compass heading?

WPS provides a more accurate compass heading and latitude/longitude position than is available from standard platform APIs. It fuses GPS and heading data with AR tracking to create frame-to-frame stability which is more suitable for rendering virtual content. It also provides the same Unity interface across all platforms, providing helper classes to simplify working with geographic data and removing any worries about device-specific GPS issues.

Under what conditions will WPS not work at all?

WPS will fail when there is no GPS signal or when the AR tracking cannot work reliably. GPS will usually be unavailable when the device is underground or inside some buildings. AR tracking will often fail in darkness and in moving vehicles. Avoiding these situations will ensure that apps work reliably.

How much data does WPS transfer?

WPS processes all data locally on the device. It does not transfer a significant amount of data.

How will WPS impact device performance and battery life?

WPS uses approximately 10% of one CPU thread and should not have significant impact on any application that is already using ARKit/ARCore. Its battery consumption is comparable to that of the screen and 3D rendering, so it is suitable for long sessions.

How accurate is WPS?

The accuracy depends on the quality of the GPS signal. In good conditions, WPS is accurate to less than one meter with a median accuracy of about three meters. In rare situations (less than 10% of usage), users can be placed up to ten meters from the correct location, so applications should be designed with some error tolerance.