Exemplo n.º 1
0
 void OnHandLeave(object sender, LMWidgets.EventArg <HandTouchData> e)
 {
     if (HandContactState.state == HCS_HAS_HAND)
     {
         if (TargetHandId.IntValue == e.CurrentValue.ID)
         {
             TargetHandId.IntValue = -1;
             HandContactState.Change(HCS_NOHAND);
         }
     }
 }
Exemplo n.º 2
0
 void HandlePointEvent(object sender, LMWidgets.EventArg <PointData> e)
 {
     if (Time.time < 1)
     {
         return;
     }
     if (e.CurrentValue.HasData)
     {
         //Debug.Log ("Cursor moved to " + e.CurrentValue.Point);
         Cursor.transform.position = e.CurrentValue.Point;
     }
 }
Exemplo n.º 3
0
 void HandlePumpEvent(object sender, LMWidgets.EventArg <bool> e)
 {
     if (e.CurrentValue)
     {
         ++fistPumpedTrue;
     }
     else
     {
         ++fistPumpedFalse;
     }
     FistPumpFeedback.text = string.Format("Fist Pumped: {0} ({1} true, {2} false)",
                                           e.CurrentValue ? "T" : "F", fistPumpedTrue, fistPumpedFalse);
 }
Exemplo n.º 4
0
 void OnHandEnter(object sender, LMWidgets.EventArg <HandTouchData> e)
 {
     if (Time.time < 1)
     {
         return;
     }
     if (HandContactState.state == HCS_NOHAND)
     {
         TargetHandId.IntValue = e.CurrentValue.ID;
         CursorFirstPosition   = Cursor.transform.position;
         HandContactState.Change(HCS_HAS_HAND);
     }
 }
Exemplo n.º 5
0
        void HandleHandEvent(object sender, LMWidgets.EventArg <HandData> e)
        {
            if (IsCurrentHand(e.CurrentValue))
            {
                //Vector3 palmPos = e.CurrentValue.HandModel.GetPalmPosition ();
                Vector3 fingerTipPosition = e.CurrentValue.HandModel.fingers [1].GetTipPosition();
                if (!cursorSet)
                {
                    HandFirstPosition   = fingerTipPosition;
                    CursorFirstPosition = Cursor.transform.position;
                }
                else
                {
// the cursor is moved, indirectly, by the position filter, which takes the desired input as a prompt
                    //	Debug.Log ("Pushing cursor to be relative to " + e.CurrentValue.LeapHand.Id);
                    Vector3 toPos = CursorFirstPosition + (fingerTipPosition - CursorFirstPosition);
                    CursorPositionFilter.PointValue = new PointData(toPos);
                }
            }
        }
Exemplo n.º 6
0
 void HandleHandEvent(object sender, LMWidgets.EventArg <HandData> e)
 {
     HandEmitterFeedback.text = e.CurrentValue.HasHand ? string.Format("Hand ID " + e.CurrentValue.Id) : "-- no hand --";
 }
Exemplo n.º 7
0
 void HandleStrengthEvent(object sender, LMWidgets.EventArg <float> e)
 {
     StrengthFeedback.text = Mathf.RoundToInt(100 * e.CurrentValue).ToString();
 }
Exemplo n.º 8
0
        private void OnSliderToggleButtonPressed(object sender, LMWidgets.EventArg <bool> args)
        {
            //Debug.Log("ButtonPressed: " + args.CurrentValue);
//			ToggleSlider(sender as ButtonDemoToggle);
        }
Exemplo n.º 9
0
 private void OnPanelButtonPressed(object sender, LMWidgets.EventArg <bool> args)
 {
     ChangeActivePanel(sender as ButtonDemoToggle);
 }
Exemplo n.º 10
0
    private void onHandEvent(object sender, LMWidgets.EventArg <HandData> e)
    {
        if (!e.CurrentValue.HasHand)
        {
            if (m_activeObject != null)
            {
                m_activeObject.GetComponent <Renderer>().enabled = false;
            }
            return;
        }
        else
        {
            if (m_activeObject != null)
            {
                m_activeObject.GetComponent <Renderer>().enabled = true;
            }
        }

        HandModel hand = e.CurrentValue.HandModel;

        transform.rotation = hand.GetPalmRotation();
        transform.position = hand.GetPalmPosition() + (transform.up * IconOffsetDistance);

        // Transition logic below here.
        if (ModalityManager.Instance.HasActiveItem())
        {
            if (ModalityManager.Instance.ActiveItemName == "ARMHUD" && m_activeObject != null || ModalityManager.Instance.ActiveItemName == "Joyball" && m_activeObject != null)
            {
                m_activeObject = null;
                //Debug.Log("Go None");
                StopAllCoroutines();
                StartCoroutine(transitionOut(switchToNone));
            }
            return;
        }

        bool aboveHorizon = !m_raycastEmitter.RayCheck(hand.GetPalmPosition());

        if (aboveHorizon && !m_wasAboveHorizon || (aboveHorizon && m_activeObject == null))
        {
            if (m_activeObject == null)
            {
                m_activeObject = m_constellationIcon;
            }
            StopAllCoroutines();
            StartCoroutine(transitionOut(switchToConstellation));
        }
//    else if (!aboveHorizon && m_wasAboveHorizon || (!aboveHorizon && m_activeObject == null) ) {
        else if (!aboveHorizon && m_wasAboveHorizon)
        {
            if (m_activeObject == null)
            {
                m_activeObject = null;
            }
            StopAllCoroutines();
            // DECISION: Joyball icon is NOT needed due to the affordance presented by the JoyBall itself
//      StartCoroutine(transitionOut(switchToJoyball));
            StartCoroutine(transitionOut(switchToNone));
//      StartCoroutine(transitionOut(switchToGrabCycle));
        }

        m_wasAboveHorizon = aboveHorizon;
    }