Class Leap::LeapXRServiceProvider

class Leap.LeapXRServiceProvider : public Leap.LeapServiceProvider

The LeapXRServiceProvider expands on the standard LeapServiceProvider to account for the offset of the Leap device with respect to the attached HMD and warp tracked hand positions based on the motion of the headset to account for the differing latencies of the two tracking systems.

This component can be placed anywhere in your scene as long as mainCamera references the XR camera.

Public Types

enum DeviceOffsetMode

Supported modes for device offset. Used for deviceOffsetMode which allows manual adjustment of the Tracking Hardware’s virtual offset and tilt.

Values:

Default

Uses pre-defined offsets, if none are available, falls back to the constants at the top of the LeapXRServiceProvider.cs

ManualHeadOffset

Allows to specify the offset as a combination of deviceOffsetYAxis, deviceOffsetZAxis and deviceTiltXAxis.

Transform

Allows for the manual placement of the Tracking Hardware. This device offset mode is incompatible with Temporal Warping. When choosing this mode, deviceOrigin has to be set.

enum TemporalWarpingMode

Temporal warping prevents the hand coordinate system from ‘swimming’ or ‘bouncing’ when the headset moves and the user’s hands stay still. This phenomenon is caused by the differing amounts of latencies inherent in the two systems.

Values:

Auto

For PC VR and Android VR, temporal warping should set to ‘Auto’, as the correct value can be chosen automatically for these platforms.

Manual

Some non-standard platforms may use ‘Manual’ mode to adjust their latency compensation amount for temporal warping.

Images

Use ‘Images’ for scenarios that overlay Tracking Service images on tracked hand data.

Off

Public Members

long imageTimeStamp = 0

Contains the Frame.Timestamp of the most recent tracked frame. It is used for Image warping if the temporalWarpingMode is set to Auto, Manual or Images

Properties

DeviceOffsetMode deviceOffsetMode { get; set; }

Allow manual adjustment of the Tracking Hardware’s virtual offset and tilt. These settings can be used to match the physical position and orientation of the Tracking Hardware on a tracked device it is mounted on (such as a VR headset)

float deviceOffsetYAxis { get; set; }

Adjusts the Tracking Hardware’s virtual height offset from the tracked headset position. This should match the vertical offset of the physical device with respect to the headset in meters.

float deviceOffsetZAxis { get; set; }

Adjusts the Tracking Hardware’s virtual depth offset from the tracked headset position. This should match the forward offset of the physical device with respect to the headset in meters.

float deviceTiltXAxis { get; set; }

Adjusts the Tracking Hardware’s virtual X axis tilt. This should match the tilt of the physical device with respect to the headset in degrees.

Transform deviceOrigin { get; set; }

Allows for the manual placement of the Tracking Hardware. This device offset mode is incompatible with Temporal Warping. This is only used if the deviceOffsetMode is ‘Transform’.

Camera mainCamera { get; set; }

Specifies the main camera. Required for XR2 based platforms. Falls back to Camera.main if not set.

int warpingAdjustment { get; set; }

The time in milliseconds between the current frame’s headset position and the time at which the Leap frame was captured. Change this only when the TemporalWarpingMode is ‘Manual’.

bool PositionDeviceRelativeToMainCamera { get; set; }

Allows for the manual placement of the Tracking Hardware. If used with deviceOffsetMode set to anything other than ‘Transform’, you may get additional offsets.

bool updateHandInPrecull { get; set; }

Pass updated transform matrices to hands with materials that utilize the VertexOffsetShader. Won’t have any effect on hands that don’t take into account shader-global vertex offsets in their material shaders.