Tanoda
LeapProvider.cs
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) Ultraleap, Inc. 2011-2020. *
3 * *
4 * Use subject to the terms of the Apache License 2.0 available at *
5 * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
6 * between Ultraleap and you, your company or other organization. *
7 ******************************************************************************/
8
9using UnityEngine;
10using System;
11
12namespace Leap.Unity {
13
14 using TestHandPose = TestHandFactory.TestHandPose;
15
21 public abstract class LeapProvider : MonoBehaviour {
22
23 public TestHandPose editTimePose = TestHandPose.HeadMountedA;
24
25 public event Action<Frame> OnUpdateFrame;
26 public event Action<Frame> OnFixedFrame;
27 public event Action<Frame> OnPostUpdateFrame;
28
37 public abstract Frame CurrentFrame { get; }
38
47 public abstract Frame CurrentFixedFrame { get; }
48
49 protected void DispatchUpdateFrameEvent(Frame frame) {
50 if (OnUpdateFrame != null) {
51 OnUpdateFrame(frame);
52 }
53 if (OnPostUpdateFrame != null) {
54 OnPostUpdateFrame(frame);
55 }
56 }
57
58 protected void DispatchFixedFrameEvent(Frame frame) {
59 if (OnFixedFrame != null) {
60 OnFixedFrame(frame);
61 }
62 }
63
64 }
65
66 public static class LeapProviderExtensions {
67
68 public static Leap.Hand MakeTestHand(this LeapProvider provider, bool isLeft) {
69 return TestHandFactory.MakeTestHand(isLeft, Hands.Provider.editTimePose)
70 .Transform(UnityMatrixExtension.GetLeapMatrix(Hands.Provider.transform));
71 }
72
73 }
74}
The Frame class represents a set of hand and finger tracking data detected in a single frame.
Definition: Frame.cs:24
The Hand class reports the physical characteristics of a detected hand.
Definition: Hand.cs:26
Provides Frame object data to the Unity application by firing events as soon as Frame data is availab...
Definition: LeapProvider.cs:21
Action< Frame > OnFixedFrame
Definition: LeapProvider.cs:26
void DispatchUpdateFrameEvent(Frame frame)
Definition: LeapProvider.cs:49
Action< Frame > OnUpdateFrame
Definition: LeapProvider.cs:25
TestHandPose editTimePose
Definition: LeapProvider.cs:23
Action< Frame > OnPostUpdateFrame
Definition: LeapProvider.cs:27
abstract Frame CurrentFrame
The current frame for this update cycle, in world space.
Definition: LeapProvider.cs:37
abstract Frame CurrentFixedFrame
The current frame for this fixed update cycle, in world space.
Definition: LeapProvider.cs:47
void DispatchFixedFrameEvent(Frame frame)
Definition: LeapProvider.cs:58
TestHandFactory.TestHandPose TestHandPose
Definition: LeapProvider.cs:14