Tanoda
Leap.Unity.LeapXRServiceProvider Class Reference

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. More...

Inheritance diagram for Leap.Unity.LeapXRServiceProvider:
Leap.Unity.LeapServiceProvider Leap.Unity.LeapProvider

Public Types

enum  DeviceOffsetMode { Default , ManualHeadOffset , Transform }
 
enum  TemporalWarpingMode { Auto , Manual , Images , Off }
 
- Public Types inherited from Leap.Unity.LeapServiceProvider
enum  InteractionVolumeVisualization { None , LeapMotionController , StereoIR170 , Automatic }
 
enum  FrameOptimizationMode { None , ReuseUpdateForPhysics , ReusePhysicsForUpdate }
 
enum  PhysicsExtrapolationMode { None , Auto , Manual }
 
enum  TrackingOptimizationMode { Desktop , ScreenTop , HMD }
 

Public Attributes

long imageTimeStamp = 0
 
- Public Attributes inherited from Leap.Unity.LeapProvider
TestHandPose editTimePose = TestHandPose.HeadMountedA
 

Protected Member Functions

override void Reset ()
 
virtual void OnEnable ()
 
virtual void OnDisable ()
 
override void Start ()
 
override void Update ()
 
virtual void onPreCull (Camera preCullingCamera)
 
override long CalculateInterpolationTime (bool endOfFrame=false)
 
override void initializeFlags ()
 Initializes the Leap Motion policy flags. The POLICY_OPTIMIZE_HMD flag improves tracking for head-mounted devices. More...
 
override void transformFrame (Frame source, Frame dest)
 
void resetShaderTransforms ()
 Resets shader globals for the Hand transforms. More...
 
virtual LeapTransform GetWarpedMatrix (long timestamp, bool updateTemporalCompensation=true)
 
void transformHands (ref LeapTransform LeftHand, ref LeapTransform RightHand)
 
void OnPreCullHandTransforms (Camera camera)
 
- Protected Member Functions inherited from Leap.Unity.LeapServiceProvider
virtual void Reset ()
 
virtual void Awake ()
 
virtual void Start ()
 
virtual void Update ()
 
virtual void FixedUpdate ()
 
virtual void OnDestroy ()
 
virtual void OnApplicationPause (bool isPaused)
 
virtual void OnApplicationQuit ()
 
virtual long CalculateInterpolationTime (bool endOfFrame=false)
 
virtual void initializeFlags ()
 Initializes Leap Motion policy flags. More...
 
void createController ()
 Creates an instance of a Controller, initializing its policy flags and subscribing to its connection event. More...
 
void destroyController ()
 Stops the connection for the existing instance of a Controller, clearing old policy flags and resetting the Controller to null. More...
 
bool checkConnectionIntegrity ()
 Checks whether this provider is connected to a service; If it is not, attempt to reconnect at regular intervals for MAX_RECONNECTION_ATTEMPTS More...
 
void onHandControllerConnect (object sender, LeapEventArgs args)
 
virtual void transformFrame (Frame source, Frame dest)
 
- Protected Member Functions inherited from Leap.Unity.LeapProvider
void DispatchUpdateFrameEvent (Frame frame)
 
void DispatchFixedFrameEvent (Frame frame)
 

Protected Attributes

bool _updateHandInPrecull = false
 
TransformHistory transformHistory = new TransformHistory()
 
bool manualUpdateHasBeenCalledSinceUpdate
 
Vector3 warpedPosition = Vector3.zero
 
Quaternion warpedRotation = Quaternion.identity
 
Matrix4x4[] _transformArray = new Matrix4x4[2]
 
- Protected Attributes inherited from Leap.Unity.LeapServiceProvider
InteractionVolumeVisualization _interactionVolumeVisualization = InteractionVolumeVisualization.LeapMotionController
 
FrameOptimizationMode _frameOptimization = FrameOptimizationMode.None
 
PhysicsExtrapolationMode _physicsExtrapolation = PhysicsExtrapolationMode.Auto
 
float _physicsExtrapolationTime = 1.0f / 90.0f
 
TrackingOptimizationMode _trackingOptimization = TrackingOptimizationMode.Desktop
 
bool _workerThreadProfiling = false
 
string _serverNameSpace = "Leap Service"
 
bool _useInterpolation = true
 
int ExtrapolationAmount = 0
 
int BounceAmount = 0
 
Controller _leapController
 
bool _isDestroyed
 
SmoothedFloat _fixedOffset = new SmoothedFloat()
 
SmoothedFloat _smoothedTrackingLatency = new SmoothedFloat()
 
long _unityToLeapOffset
 
Frame _untransformedUpdateFrame
 
Frame _transformedUpdateFrame
 
Frame _untransformedFixedFrame
 
Frame _transformedFixedFrame
 

Properties

DeviceOffsetMode deviceOffsetMode [get, set]
 
float deviceOffsetYAxis [get, set]
 
float deviceOffsetZAxis [get, set]
 
float deviceTiltXAxis [get, set]
 
Transform deviceOrigin [get, set]
 
Camera preCullCamera [get, set]
 
int warpingAdjustment [get, set]
 
bool updateHandInPrecull [get, set]
 
- Properties inherited from Leap.Unity.LeapServiceProvider
InteractionVolumeVisualization SelectedInteractionVolumeVisualization [get]
 
Action< DeviceOnDeviceSafe
 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. More...
 
override Frame CurrentFrame [get]
 
override Frame CurrentFixedFrame [get]
 
- Properties inherited from Leap.Unity.LeapProvider
abstract Frame CurrentFrame [get]
 The current frame for this update cycle, in world space. More...
 
abstract Frame CurrentFixedFrame [get]
 The current frame for this fixed update cycle, in world space. More...
 

Additional Inherited Members

- Public Member Functions inherited from Leap.Unity.LeapServiceProvider
float CalculatePhysicsExtrapolation ()
 
Controller GetLeapController ()
 Returns the Leap Controller instance. More...
 
bool IsConnected ()
 Returns true if the Leap Motion hardware is plugged in and this application is connected to the Leap Motion service. More...
 
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. More...
 
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. More...
 
- Static Protected Attributes inherited from Leap.Unity.LeapServiceProvider
const double NS_TO_S = 1e-6
 Converts nanoseconds to seconds. More...
 
const double S_TO_NS = 1e6
 Converts seconds to nanoseconds. More...
 
const string HAND_ARRAY_GLOBAL_NAME = "_LeapHandTransforms"
 The transform array used for late-latching. More...
 
const int MAX_RECONNECTION_ATTEMPTS = 5
 The maximum number of times the provider will attempt to reconnect to the service before giving up. More...
 
const int RECONNECTION_INTERVAL = 180
 The number of frames to wait between each reconnection attempt. More...
 
- Events inherited from Leap.Unity.LeapProvider
Action< FrameOnUpdateFrame
 
Action< FrameOnFixedFrame
 
Action< FrameOnPostUpdateFrame
 

Detailed Description

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.

Definition at line 25 of file LeapXRServiceProvider.cs.

Member Enumeration Documentation

◆ DeviceOffsetMode

Enumerator
Default 
ManualHeadOffset 
Transform 

Definition at line 35 of file LeapXRServiceProvider.cs.

◆ TemporalWarpingMode

Enumerator
Auto 
Manual 
Images 
Off 

Definition at line 120 of file LeapXRServiceProvider.cs.

Member Function Documentation

◆ CalculateInterpolationTime()

override long Leap.Unity.LeapXRServiceProvider.CalculateInterpolationTime ( bool  endOfFrame = false)
protectedvirtual

Reimplemented from Leap.Unity.LeapServiceProvider.

Definition at line 390 of file LeapXRServiceProvider.cs.

◆ GetWarpedMatrix()

virtual LeapTransform Leap.Unity.LeapXRServiceProvider.GetWarpedMatrix ( long  timestamp,
bool  updateTemporalCompensation = true 
)
protectedvirtual

Definition at line 438 of file LeapXRServiceProvider.cs.

◆ initializeFlags()

override void Leap.Unity.LeapXRServiceProvider.initializeFlags ( )
protectedvirtual

Initializes the Leap Motion policy flags. The POLICY_OPTIMIZE_HMD flag improves tracking for head-mounted devices.

Reimplemented from Leap.Unity.LeapServiceProvider.

Definition at line 410 of file LeapXRServiceProvider.cs.

◆ OnDisable()

virtual void Leap.Unity.LeapXRServiceProvider.OnDisable ( )
protectedvirtual

Definition at line 257 of file LeapXRServiceProvider.cs.

◆ OnEnable()

virtual void Leap.Unity.LeapXRServiceProvider.OnEnable ( )
protectedvirtual

Definition at line 230 of file LeapXRServiceProvider.cs.

◆ onPreCull()

virtual void Leap.Unity.LeapXRServiceProvider.onPreCull ( Camera  preCullingCamera)
protectedvirtual

Definition at line 345 of file LeapXRServiceProvider.cs.

◆ OnPreCullHandTransforms()

void Leap.Unity.LeapXRServiceProvider.OnPreCullHandTransforms ( Camera  camera)
protected

Definition at line 526 of file LeapXRServiceProvider.cs.

◆ Reset()

override void Leap.Unity.LeapXRServiceProvider.Reset ( )
protectedvirtual

Reimplemented from Leap.Unity.LeapServiceProvider.

Definition at line 208 of file LeapXRServiceProvider.cs.

◆ resetShaderTransforms()

void Leap.Unity.LeapXRServiceProvider.resetShaderTransforms ( )
protected

Resets shader globals for the Hand transforms.

Definition at line 432 of file LeapXRServiceProvider.cs.

◆ Start()

override void Leap.Unity.LeapXRServiceProvider.Start ( )
protectedvirtual

Reimplemented from Leap.Unity.LeapServiceProvider.

Definition at line 271 of file LeapXRServiceProvider.cs.

◆ transformFrame()

override void Leap.Unity.LeapXRServiceProvider.transformFrame ( Frame  source,
Frame  dest 
)
protectedvirtual

Reimplemented from Leap.Unity.LeapServiceProvider.

Definition at line 420 of file LeapXRServiceProvider.cs.

◆ transformHands()

void Leap.Unity.LeapXRServiceProvider.transformHands ( ref LeapTransform  LeftHand,
ref LeapTransform  RightHand 
)
protected

Definition at line 518 of file LeapXRServiceProvider.cs.

◆ Update()

override void Leap.Unity.LeapXRServiceProvider.Update ( )
protectedvirtual

Reimplemented from Leap.Unity.LeapServiceProvider.

Definition at line 286 of file LeapXRServiceProvider.cs.

Member Data Documentation

◆ _transformArray

Matrix4x4 [] Leap.Unity.LeapXRServiceProvider._transformArray = new Matrix4x4[2]
protected

Definition at line 188 of file LeapXRServiceProvider.cs.

◆ _updateHandInPrecull

bool Leap.Unity.LeapXRServiceProvider._updateHandInPrecull = false
protected

Definition at line 171 of file LeapXRServiceProvider.cs.

◆ imageTimeStamp

long Leap.Unity.LeapXRServiceProvider.imageTimeStamp = 0

Definition at line 202 of file LeapXRServiceProvider.cs.

◆ manualUpdateHasBeenCalledSinceUpdate

bool Leap.Unity.LeapXRServiceProvider.manualUpdateHasBeenCalledSinceUpdate
protected

Definition at line 185 of file LeapXRServiceProvider.cs.

◆ transformHistory

TransformHistory Leap.Unity.LeapXRServiceProvider.transformHistory = new TransformHistory()
protected

Definition at line 184 of file LeapXRServiceProvider.cs.

◆ warpedPosition

Vector3 Leap.Unity.LeapXRServiceProvider.warpedPosition = Vector3.zero
protected

Definition at line 186 of file LeapXRServiceProvider.cs.

◆ warpedRotation

Quaternion Leap.Unity.LeapXRServiceProvider.warpedRotation = Quaternion.identity
protected

Definition at line 187 of file LeapXRServiceProvider.cs.

Property Documentation

◆ deviceOffsetMode

DeviceOffsetMode Leap.Unity.LeapXRServiceProvider.deviceOffsetMode
getset

Definition at line 47 of file LeapXRServiceProvider.cs.

◆ deviceOffsetYAxis

float Leap.Unity.LeapXRServiceProvider.deviceOffsetYAxis
getset

Definition at line 65 of file LeapXRServiceProvider.cs.

◆ deviceOffsetZAxis

float Leap.Unity.LeapXRServiceProvider.deviceOffsetZAxis
getset

Definition at line 76 of file LeapXRServiceProvider.cs.

◆ deviceOrigin

Transform Leap.Unity.LeapXRServiceProvider.deviceOrigin
getset

Definition at line 95 of file LeapXRServiceProvider.cs.

◆ deviceTiltXAxis

float Leap.Unity.LeapXRServiceProvider.deviceTiltXAxis
getset

Definition at line 86 of file LeapXRServiceProvider.cs.

◆ preCullCamera

Camera Leap.Unity.LeapXRServiceProvider.preCullCamera
getset

Definition at line 105 of file LeapXRServiceProvider.cs.

◆ updateHandInPrecull

bool Leap.Unity.LeapXRServiceProvider.updateHandInPrecull
getset

Definition at line 172 of file LeapXRServiceProvider.cs.

◆ warpingAdjustment

int Leap.Unity.LeapXRServiceProvider.warpingAdjustment
getset

Definition at line 147 of file LeapXRServiceProvider.cs.


The documentation for this class was generated from the following file: