Esempio n. 1
0
    private bool IsIdleAndOnShell(MarkHand hand)
    {
        if (hand.HandState != MarkHandState.Idle)
        {
            return(false);
        }

        var centerToHand  = hand.Leap.leapHand.PalmPosition.ToUnity() - transform.position;
        var angle         = Vector3.Dot(centerToHand.normalized, hand.Leap.leapHand.PalmNormal.ToUnity());
        var shellDistance = centerToHand.magnitude / mark.Radius;

        //Debug.Log(shellDistance + " " + angle);
        if (angle > 0.8f && shellDistance > 0.8f && shellDistance < 1.05f)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
Esempio n. 2
0
    void Start()
    {
        mark       = GetComponent <MarkNode>();
        leftHand   = mark.LeftHand;
        rightHand  = mark.RightHand;
        grabSphere = transform.Find("GrabSphere").gameObject;
        grabSphere.SetActive(false);

        grabSphereMaterial = grabSphere.GetComponent <Renderer>().material;

        grabSphereAnchoring = grabSphere.GetComponent <PinchAnchor>();
        grabSphereAnchoring.AllowAnchoring        = false;
        grabSphereAnchoring.OnAnchoringSelection += (s, e) => {
            if (e != null)
            {
                mark.AnchorToCenter(e);
            }
        };

        grabSphereLeap = grabSphere.GetComponent <InteractionBehaviour>();
        grabSphereLeap.OnGraspBegin += GrabSphereGraspBegin;
        grabSphereLeap.OnGraspStay  += GrabSphereGraspStay;
        grabSphereLeap.OnGraspEnd   += GrabSphereGraspedEnd;
    }