Class Leap::LeapServiceProvider

class Leap.LeapServiceProvider : public Leap.LeapProvider

The LeapServiceProvider provides tracked Leap Hand data and images from the device via the Leap service running on the client machine.

It communicates with the Ultraleap Tracking Service running on your platform, and provides Frame objects containing Leap hands to your application. Generally, any class that needs hand tracking data from the camera will need a reference to a LeapServiceProvider to get that data.

Subclassed by Leap.LeapXRServiceProvider

Public Types

enum InteractionVolumeVisualization

The supported interaction volumes that will be visualized in the scene view

Values:

None
LeapMotionController
StereoIR170
Device_3Di
Automatic
LeapMotionController2
enum FrameOptimizationMode

Supported modes to optimize frame updates. When enabled, the provider will reuse some hand data: By default the mode is set to None, which implies that we want to use hand tracking in time with Unity’s Update loop. It can be set to ReuseUpdateForPhysics (choose as Android user), or ReusePhysicsForUpdate (reinterpolates the hand data for the physics timestep).

Values:

None

By default the mode is set to None, this implies that we want to use hand tracking in time with Unity’s Update loop.

ReuseUpdateForPhysics

Android users should choose Reuse Update for Physics.

ReusePhysicsForUpdate

Provides the option to reinterpolate the hand data for the physics timestep, improving the movement of objects being manipulated by hands when using the interaction engine. Enabling this incurs a small time penalty (fraction of a ms).

enum PhysicsExtrapolationMode

Supported modes to use when extrapolating physics.

Values:

None

No extrapolation is used at all

Auto

Extrapolation is chosen based on the fixed timestep

Manual

Extrapolation time is chosen manually by the user

enum TrackingOptimizationMode

(Service must be >= 4.9.2) The tracking mode used by the service. Should be set to match the orientation of the hand tracking hardware.

Values:

Desktop
Screentop
HMD

The LeapXRServiceProvider should be used for all XR headset based applications, where hand tracking devices are mounted on the headset. The LeapXRServiceProvider uses the HMD tracking optimization mode.

Public Functions

float CalculatePhysicsExtrapolation ()

Calculates the physics extrapolation time depending on the PhysicsExtrapolationMode.

Return

A float that can be used to compensate for latency when ensuring that our hands are on the same timeline as Update.

Controller GetLeapController ()

Returns the Leap Controller instance. If not found, it creates a new controller instance.

bool IsConnected ()

Returns true if the Leap Motion hardware is plugged in and this application is connected to the Leap Motion service.

void RetransformFrames ()

Retransforms hand data from Leap space to the space of the Unity transform. This is only necessary if you’re moving the LeapServiceProvider around in a custom script and trying to access Hand data from it directly afterward.

void CopySettingsToLeapXRServiceProvider (LeapXRServiceProvider leapXRServiceProvider)

Copies property settings from this LeapServiceProvider to the target LeapXRServiceProvider where applicable. Does not modify any XR-specific settings that only exist on the LeapXRServiceProvider.

void ChangeTrackingMode (TrackingOptimizationMode trackingMode)

Triggers a coroutine that sets appropriate policy flags and wait for them to be set to ensure we’ve changed mode

Param trackingMode

Tracking mode to set

TrackingOptimizationMode GetTrackingMode ()

Gets the current mode by polling policy flags

void destroyController ()

Stops the connection for the existing instance of a Controller, clearing old policy flags and resetting the Controller to null.

Public Members

bool _useInterpolation = true

Determines if the service provider should temporally resample frames for smoothness.

Properties

InteractionVolumeVisualization SelectedInteractionVolumeVisualization { get; set; }

Which interaction volume is selected to be visualized in the scene view

string SpecificSerialNumber { get; set; }

When Multiple Device Mode is set to Specific, the provider will receive data from only the first device that contain this in their serial number. If no device serial number contains SpecificSerialNumber, the first device in the list of connected devices (controller.Devices) is used

Device CurrentDevice { get; set; }

The tracking device currently associated with this provider

List<Device> Devices { get; set; }

The list of currently attached and recognized Leap Motion controller devices. The Device objects in the list describe information such as the range and tracking volume.

Action<Device> OnDeviceSafe { get; set; }

A utility event to get a callback whenever a new device is connected to the service. This callback will ALSO trigger a callback upon subscription if a device is already connected.

For situations with multiple devices OnDeviceSafe will be dispatched once for each device.

Action<Device> OnDeviceChanged { get; set; }

An event that is dispatched whenever the Service provider changes device (eg. when the SpecificSerialNumber changes during runtime) the param Device is the new CurrentDevice

overrideFrame CurrentFrame { get; set; }

The current frame for this update cycle, in world space.

IMPORTANT! This frame might be mutable! If you hold onto a reference to this frame, or a reference to any object that is a part of this frame, it might change unexpectedly. If you want to save a reference, make sure to make a copy.

overrideFrame CurrentFixedFrame { get; set; }

The current frame for this fixed update cycle, in world space.

IMPORTANT! This frame might be mutable! If you hold onto a reference to this frame, or a reference to any object that is a part of this frame, it might change unexpectedly. If you want to save a reference, make sure to make a copy.

LeapTransform DeviceOriginWorldSpace { get; set; }

The world space position of the Tracking Camera Origin that was last used to position the hands in world space

class LeapFOVInfo
class LeapFOVInfos