class ARWorldPositioningManager
(Niantic.Lightship.AR.WorldPositioning.ARWorldPositioningManager)
Overview
The ARWorldPositioningManager class controls the XRWorldPositioningSubsystem and provides access to the underlying AR to world transform from the World Positioning System (WPS).
class ARWorldPositioningManager: SubsystemLifecycleManager< XRWorldPositioningSubsystem, XRWorldPositioningSubsystemDescriptor, XRWorldPositioningSubsystem.Provider > {
public:
// fields
bool IsAvailable => Status == WorldPositioningStatus.Available;
Action<WorldPositioningStatus> OnStatusChanged;
// properties
ARWorldPositioningTangentialTransform WorldTransform;
WorldPositioningStatus? Status;
ARWorldPositioningCameraHelper DefaultCameraHelper;
// methods
void Update();
WorldPositioningStatus TryGetXRToWorld(
ref Matrix4x4 arToWorld,
ref double originLatitude,
ref double originLongitude,
ref double originAltitude
);
void OverrideTransform(ARWorldPositioningTangentialTransform simulatedTransform);
void EndOverride();
protected:
// methods
override void OnDisable();
};
Detailed Documentation
The ARWorldPositioningManager class controls the XRWorldPositioningSubsystem and provides access to the underlying AR to world transform from the World Positioning System (WPS).
It is unlikely that an application will need to use the value of WorldTransform directly. For applications requiring only a more accurate/stable version of GPS & compass, the properties on DefaultCameraHelper can be accessed to obtain Latitude, Longitude and Heading values which work similarly to those available through location services.
The transform can also be used to place objects into the AR View using geographic coordinates. WorldPositioningPositioningHelper provides a more convenient interface for adding objects to the scene and updating their positions as WPS data becomes more accurate.
Fields
IsAvailable
bool IsAvailable => Status == WorldPositioningStatus.Available
Returns true if World Positioning is available.
OnStatusChanged
Action<WorldPositioningStatus> OnStatusChanged
Action that is called when the status changes
Properties
WorldTransform
ARWorldPositioningTangentialTransform WorldTransform
The current estimate of the transform between the AR tracking coordinates and the world geographic coordinate system. This property should only be used when the Status property is Available, otherwise it is undefined.
Status
WorldPositioningStatus? Status
The Status of the WorldTransform estimate. The WorldTransform is only valid when Status is Available.
DefaultCameraHelper
ARWorldPositioningCameraHelper DefaultCameraHelper
A ARWorldPositioningCameraHelper which is automatically generated for the default AR camera
Methods
OverrideTransform
void OverrideTransform(ARWorldPositioningTangentialTransform simulatedTransform)
Overrides the World Positioning transform with the value specified. This method allows the developer to simulate different locations. The ARWorldPositioningEditorControls class can be used to simulate different locations in the Unity editor.
EndOverride
void EndOverride()
Stops overriding the World Positioning transform. Use this to switch back to the real transform (on a device) or playback (in the Unity editor)