Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (_leapManager)
        {
            if (_leapManager.pointerAvailible && !LeapManager.isHandOpen(_leapManager.frontmostHand()))
            {
                Vector2 pointerPositionScreen = _leapManager.pointerPositionScreen;
                pointerPositionScreen.y = pointerPositionScreen.y + 30;

                m_button1.UpdateState(pointerPositionScreen);
                m_button2.UpdateState(pointerPositionScreen);
            }
        }
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (_leapManager)
        {
            if (_leapManager.pointerAvailible && !LeapManager.isHandOpen(_leapManager.frontmostHand()) /* && !any_menu_active*/)
            {
                arrowTexture[0].SetActive(true);

                gameObject.transform.position = new Vector3(_leapManager.pointerPositionScreen.x / Camera.main.pixelWidth, _leapManager.pointerPositionScreen.y / Camera.main.pixelHeight, 0.0f);
            }
            else
            {
                arrowTexture[0].SetActive(false);
            }
        }
    }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        if (_leapManager.frontmostHand().IsValid&& LeapManager.isHandOpen(_leapManager.frontmostHand()))
        {
            Hand    hand         = _leapManager.frontmostHand();
            Vector3 handLocation = hand.PalmPosition.ToUnityTranslated();

            if (hand.Id != _lastHandId)
            {
                _handPositionOnAquire = handLocation;
                _lastHandId           = hand.Id;
            }

            handLocation = _lastHandPositionOnLoss + (handLocation - _handPositionOnAquire);

            handLocation.y = Mathf.Clamp(handLocation.y, _controlMin.y, _controlMax.y);

            _lastHandPosition = handLocation;

            Quaternion yRotation = Quaternion.Euler(new Vector3(
                                                        0,
                                                        (((handLocation.x - _controlMin.x) / (_controlMax.x - _controlMin.x)) * 180.0f) + 90.0f,
                                                        0
                                                        ));

            Quaternion xRotation = Quaternion.Euler(new Vector3(
                                                        ((1 - ((handLocation.y - _controlMin.y) / (_controlMax.y - _controlMin.y))) * 180.0f) + 90.0f,
                                                        0,
                                                        0));

            Vector3 directionVector = yRotation * xRotation * Vector3.forward;

            float dist = ((1.0f - Mathf.Clamp((handLocation.z - _controlMin.z) / (_controlMax.z - _controlMin.x), 0.0f, 1.0f)) * (_distanceLimits.y - _distanceLimits.x)) + _distanceLimits.x;
            gameObject.transform.position = directionVector * dist;
            gameObject.transform.LookAt(_targetObject.transform);
        }
        else
        {
            _lastHandId             = -1;
            _lastHandPositionOnLoss = _lastHandPosition;
        }
    }
Exemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        if (_leapManager.frontmostHand().IsValid&& LeapManager.isHandOpen(_leapManager.frontmostHand()))
        {
            Vector3 handLocation = _leapManager.frontmostHand().PalmPosition.ToUnityTranslated();

            Quaternion yRotation = Quaternion.Euler(new Vector3(
                                                        0,
                                                        360 - (Mathf.Clamp((handLocation.x - _controlMin.x) / (_controlMax.x - _controlMin.x), 0, 1.0f) * 360.0f) + 90.0f,
                                                        0
                                                        ));

            Quaternion xRotation = Quaternion.Euler(new Vector3(
                                                        (Mathf.Clamp((handLocation.y - _controlMin.y) / (_controlMax.y - _controlMin.y), 0, 1.0f) * 180.0f) + 90.0f,
                                                        0,
                                                        0));

            Vector3 directionVector = yRotation * xRotation * Vector3.forward;

            float dist = ((1.0f - Mathf.Clamp((handLocation.z - _controlMin.z) / (_controlMax.z - _controlMin.x), 0.0f, 1.0f)) * (_distanceLimits.y - _distanceLimits.x)) + _distanceLimits.x;
            gameObject.transform.position = directionVector * dist;
            gameObject.transform.LookAt(_targetObject.transform);
        }
    }
Exemplo n.º 5
0
 // Update is called once per frame
 void Update()
 {
     text.text = "Hand Open: " + LeapManager.isHandOpen(_leapManager.frontmostHand());
 }