Ejemplo n.º 1
0
    public override bool Detected()
    {
        DetectionManager.DetectionHand detectHand = DetectionManager.Get().GetHand(m_Hand);

        if (detectHand.IsSet())
        {
            return(detectHand.CheckWithDetails(m_GestureDetail));
        }

        return(false);
    }
Ejemplo n.º 2
0
    public override bool Detected()
    {
        DetectionManager.DetectionHand detectHand = DetectionManager.Get().GetHand(m_Hand);

        EFinger indexFinger = EFinger.eThumb + 1;

        if (detectHand.IsSet())
        {
            if (detectHand.CheckWithDetails(m_GestureDetail))
            {
                var rot = detectHand.GetRotation();

                if (timeBegin == false)
                {
                    timeElapsed = timeReset;
                    timeBegin   = true;
                }

                //Debug.DrawRay(detectHand.GetFinger(indexFinger).GetTipPosition(), detectHand.GetFinger(indexFinger).GetFingerDirection() * 3.0f, Color.white);
                //Debug.DrawRay(DetectionManager.Get().GetHand(m_Hand).GetHandPosition(), detectionHand.GetHandAxis(m_HandAxis) * 1000, Color.red);


                //Debug.Log(stayTime);


                if (rot.x > 0.25f && m_CoolDownLeft <= 0.0f && timeElapsed >= 3.5f && timeElapsed <= 8.0f && timeBegin)
                {
                    m_CoolDownLeft = m_CooldownTime;
                    GameObject projectile = Instantiate(prefab) as GameObject;
                    var        spawn      = detectHand.GetFinger(indexFinger).GetTipPosition();

                    projectile.transform.position = spawn;
                    Rigidbody rb = projectile.GetComponent <Rigidbody>();
                    //var di = detectHand.GetFinger(indexFinger).GetFingerDirection();
                    //di.y -= 0.6f;
                    // di.z += 0.3f;
                    //di.x += 0.2f;
                    //rb.AddForce(Camera.main.transform.forward * 20f, ForceMode.VelocityChange);
                    rb.velocity = Vector3.forward * 8;
                    timeBegin   = false;
                }


                return(true);
            }
        }

        return(false);
    }
Ejemplo n.º 3
0
    void IsHandAllExtended()
    {
        DetectionManager.DetectionHand detectHand = DetectionManager.Get().GetHand(m_Hand);

        if (detectHand.IsSet())
        {
            if (detectHand.CheckWithDetails(m_GestureDetail))
            {
                m_IsHandAllExtended = true;
                Debug.Log("success");
                //m_menumanager.PresentingthisObjectMenu();
                alreadyFist = false;
                //reset
                return;
            }
        }
        //m_IsHandAllExtended = false;
    }
Ejemplo n.º 4
0
    public override bool Detected()
    {
        EFinger thumbFinger  = EFinger.eThumb;
        EFinger middleFinger = EFinger.eThumb + 2;

        m_DetectHand = DetectionManager.Get().GetHand(m_Hand);

        if (m_DetectHand.IsSet())
        {
            if (m_DetectHand.CheckWithDetails(m_GestureDetail))
            {
                //Debug.Log("ok");
                //Debug.DrawRay(m_DetectHand.GetFinger(indexFinger).GetTipPosition(), m_DetectHand.GetFinger(indexFinger).GetFingerDirection() * 1000, Color.white);
                snap = true;

                /*var thumbTipPosition = m_DetectHand.GetFinger(thumbFinger).GetTipPosition();
                 * var middleTipPosition = m_DetectHand.GetFinger(middleFinger).GetTipPosition();
                 * float distance = Vector3.Distance(thumbTipPosition, middleTipPosition);
                 * Debug.Log(distance);
                 * if (distance < DeactivateDistance)
                 *  return true;*/
                gapLeft = timeGap;
            }

            //Debug.Log(gapLeft);
            if (snap && gapLeft > 0.0f)
            {
                var   thumbTipPosition  = m_DetectHand.GetFinger(thumbFinger).GetTipPosition();
                var   middleTipPosition = m_DetectHand.GetFinger(middleFinger).GetTipPosition();
                float distance          = Vector3.Distance(thumbTipPosition, middleTipPosition);
                // Debug.Log(distance);
                if (distance < 0.02f)
                {
                    // Debug.Log("snap");
                    return(true);
                }
            }
        }

        return(false);
    }