Esempio n. 1
0
        void CaptureGaze(GazeTarget target, RaycastHit hit)
        {
            if (currentGazeTarget == target)
            {
                target.GazeJustEntered = false;
                target.GazeHitPoint    = hit;

                OnGazeStay?.Invoke(target, hit);

                return;
            }

            if (currentGazeTarget != null)
            {
                BreakGaze();
            }

            target.GazeJustEntered = true;
            target.GazeActive      = true;
            target.GazeHitPoint    = hit;

            currentGazeTarget = target;

            OnGazeEnter?.Invoke(target, hit);
        }
Esempio n. 2
0
        void BreakGaze()
        {
            if (currentGazeTarget == null)
            {
                return;
            }

            currentGazeTarget.GazeActive      = false;
            currentGazeTarget.GazeHitPoint    = default;
            currentGazeTarget.GazeJustEntered = false;

            OnGazeExit?.Invoke(currentGazeTarget);

            currentGazeTarget = null;
        }
Esempio n. 3
0
        void UpdateGaze()
        {
            Ray R = new Ray(poseDriver.transform.position, poseDriver.transform.forward);

            if (Physics.Raycast(R, out RaycastHit Rh, GazeDistanceLimit))
            {
                GazeTarget T = Rh.transform.GetComponent <GazeTarget>();

                if (T == null)
                {
                    BreakGaze( );
                }

                else
                {
                    CaptureGaze(T, Rh);
                }
            }
        }