// Use this for initialization void Start() { provider = FindObjectOfType <LeapProvider>() as LeapProvider; newFluids = FindObjectOfType <Fluids>() as Fluids; position = new Vector3(0, 0, 0); isClosedFist = false; }
private void Awake() { if (!Application.isPlaying) { return; } init = false; if (leapProvider == null) { //Try to set the provider for the user leapProvider = Hands.Provider; if (leapProvider == null) { Debug.LogError("No leap provider found in the scene, hand model has been disabled", this.gameObject); this.enabled = false; this.gameObject.SetActive(false); return; } } if (HandModelType == ModelType.Graphics) { leapProvider.OnUpdateFrame -= UpdateFrame; leapProvider.OnUpdateFrame += UpdateFrame; } else { leapProvider.OnFixedFrame -= FixedUpdateFrame; leapProvider.OnFixedFrame += FixedUpdateFrame; } }
protected virtual void OnEnable() { provider = requireComponent <Leap.Hololens.LeapServiceProvider>(); pool = requireComponent <HandPool>(); provider.OnUpdateFrame += OnUpdateFrame; provider.OnFixedFrame += OnFixedFrame; }
protected virtual void OnEnable() { provider = requireComponent <LeapProvider>(); factory = requireComponent <HandFactory>(); provider.OnUpdateFrame += OnUpdateFrame; provider.OnFixedFrame += OnFixedFrame; }
private void validateInput() { if (detectCycle()) { _inputLeapProvider = null; Debug.LogError("The input to the post-process provider on " + gameObject.name + " causes an infinite cycle, so its input has been set to null."); } }
protected virtual void Start() { Factory = requireComponent <HandFactory>(); //Felix if (Provider == null) { Provider = GetComponent <LeapProvider>(); } }
void Update() { if (!EditorApplication.isPlaying && SupportsEditorPersistence()) { LeapProvider provider = null; //First try to get the provider from a parent HandModelManager if (transform.parent != null) { var manager = transform.parent.GetComponent <HandModelManager>(); if (manager != null) { provider = manager.leapProvider; } } //If not found, use any old provider from the Hands.Provider getter if (provider == null) { provider = Hands.Provider; } Hand hand = null; //If we found a provider, pull the hand from that if (provider != null) { var frame = provider.CurrentFrame; if (frame != null) { hand = frame.Get(Handedness); } } //If we still have a null hand, construct one manually if (hand == null) { hand = TestHandFactory.MakeTestHand(Handedness == Chirality.Left, unitType: TestHandFactory.UnitType.LeapUnits); hand.Transform(transform.GetLeapMatrix()); } if (GetLeapHand() == null) { SetLeapHand(hand); InitHand(); BeginHand(); UpdateHand(); } else { SetLeapHand(hand); UpdateHand(); } } }
protected virtual void OnEnable() { if (_leapProvider == null) { _leapProvider = Hands.Provider; } _leapProvider.OnUpdateFrame -= OnUpdateFrame; _leapProvider.OnUpdateFrame += OnUpdateFrame; _leapProvider.OnFixedFrame -= OnFixedFrame; _leapProvider.OnFixedFrame += OnFixedFrame; }
private bool detectCycle() { LeapProvider providerA = _inputLeapProvider, providerB = _inputLeapProvider; while (providerA is PostProcessProvider) { providerB = (providerB as PostProcessProvider).inputLeapProvider; if (providerA == providerB) { return true; } else if (!(providerB is PostProcessProvider)) { return false; } providerA = (providerA as PostProcessProvider).inputLeapProvider; providerB = (providerB as PostProcessProvider).inputLeapProvider; if (!(providerB is PostProcessProvider)) { return false; } } return false; }
public static Hand Get(this LeapProvider provider, Chirality whichHand) { Frame frame; if (Time.inFixedTimeStep) { frame = provider.CurrentFixedFrame; } else { frame = provider.CurrentFrame; } return(frame.GetHand(whichHand)); }
protected virtual void Start() { //provider = requireComponent<LeapProvider>(); factory = requireComponent <HandFactory>(); //Felix if (provider == null) { provider = GetComponent <LeapProvider>(); } //Felix /*if (Player == null) * { * Player = GetComponent<LeapPlayer>(); * }*/ }
protected virtual void OnEnable() { provider = requireComponent <LeapProvider>(); provider.OnUpdateFrame += OnUpdateFrame; provider.OnFixedFrame += OnFixedFrame; laction = ActionType.Null; raction = ActionType.Null; for (int i = 0; i < TYPES; i++) { List <double> lnewList = new List <double>(); lcount.Add(lnewList); List <double> rnewList = new List <double>(); rcount.Add(rnewList); } }
protected virtual void OnEnable() { //追加 if (isMain) { _mains.Add(this); } _all.Add(this); if (_leapProvider == null) { _leapProvider = Hands.Provider; } _leapProvider.OnUpdateFrame -= OnUpdateFrame; _leapProvider.OnUpdateFrame += OnUpdateFrame; _leapProvider.OnFixedFrame -= OnFixedFrame; _leapProvider.OnFixedFrame += OnFixedFrame; }
private static void InitStatic() { s_provider = GameObject.FindObjectOfType <LeapProvider>(); if (s_provider == null) { return; } Camera providerCamera = s_provider.GetComponentInParent <Camera>(); if (providerCamera == null) { return; } if (providerCamera.transform.parent == null) { return; } s_leapRig = providerCamera.transform.parent.gameObject; }
private void OnEnable() { if (_provider == null) { _provider = Hands.Provider; } if (_frameRateText == null) { _frameRateText = GetComponentInChildren <TextMesh>(); if (_frameRateText == null) { Debug.LogError("Could not enable FpsLabel because no TextMesh was specified!"); enabled = false; } } _smoothedRenderFps.delay = 0.3f; _smoothedRenderFps.reset = true; }
protected virtual void Start() { provider = requireComponent <LeapProvider>(); factory = requireComponent <HandFactory>(); }
public static Leap.Hand MakeTestHand(this LeapProvider provider, bool isLeft) { return(TestHandFactory.MakeTestHand(isLeft, Hands.Provider.editTimePose) .Transform(UnityMatrixExtension.GetLeapMatrix(Hands.Provider.transform))); }
// Use this for initialization void Start() { light = GetComponent <Light>(); provider = FindObjectOfType <LeapProvider>() as LeapProvider; Color.RGBToHSV(light.color, out hue, out sat, out val); }