This is a pointer for gazing and interacting with things It should be attached to the camera, and the object's forward direction should match with where it is pointing.
Inheritance: MonoBehaviour
Ejemplo n.º 1
0
        private void OnGazePointerEvent(GazePointer sender, GazePointerEventArgs ea)
        {
            // Figure out what part of the GUI is currently being gazed upon
            UIElement _temp = ea.HitTarget;

            // When a new GazePointerEvent occurs, revert the previously selected object to its default (ie, non-gazed upon) appearance
            if (_previous != null)
            {
                if (_previous.Name.Equals("TestButton") || _previous.Name.Equals("SettingsButton"))
                {
                    _previous.Background = _sideDefault;
                }
                else
                {
                    _previous.Background = _navDefault;
                }
            }

            // Pass the button that was selected to the event handler to determine the appropriate action
            if (_temp.ToString().Contains("Button"))
            {
                Button _button = (Button)ea.HitTarget;
                GazeButton_Handler(_button);
            }
        }
Ejemplo n.º 2
0
    /// <summary>
    /// Returns true if the object is to be grabbed for example grabbing a pen.
    /// Returns false if the object is just a click and that's it
    /// </summary>
    public virtual bool OnInteract(GazePointer pointer)
    {
        if (!canInteract) return false;
//        Debug.Log("On Interact");

        return false;
    }
Ejemplo n.º 3
0
        private void OnGazePointerEvent(GazePointer sender, GazePointerEventArgs ea)
        {
            var button = ea.HitTarget as Button;

            if (button == null)
            {
                return;
            }

            switch (ea.State)
            {
            case GazePointerState.Fixation:
                button.BorderBrush     = _hoverBrush;
                button.BorderThickness = new Thickness(5);
                break;

            case GazePointerState.Dwell:
                _gazePointer.InvokeTarget(button);
                goto case GazePointerState.Exit;

            case GazePointerState.Exit:
                button.BorderThickness = new Thickness(0);
                break;
            }
        }
Ejemplo n.º 4
0
        public void OnXamlRendered(FrameworkElement control)
        {
            GazeInput.IsDeviceAvailableChanged += GazeInput_IsDeviceAvailableChanged;

            WarnUserToPlugInDevice();

            var buttonControl = control.FindChild("TargetButton") as Button;

            if (buttonControl != null)
            {
                buttonControl.Click += TargetButton_Click;

                gazeButtonControl = GazeInput.GetGazeElement(buttonControl);

                if (gazeButtonControl == null)
                {
                    gazeButtonControl = new GazeElement();
                    GazeInput.SetGazeElement(buttonControl, gazeButtonControl);
                }

                if (gazeButtonControl != null)
                {
                    gazeButtonControl.DwellProgressFeedback += OnProgressFeedback;
                    gazeButtonControl.Invoked      += OnGazeInvoked;
                    gazeButtonControl.StateChanged += GazeButtonControl_StateChanged;
                }
            }

            gazePointer = GazeInput.GetGazePointer(null);

            CoreWindow.GetForCurrentThread().KeyDown += (CoreWindow sender, KeyEventArgs args) => gazePointer.Click();
        }
Ejemplo n.º 5
0
        public MainPage()
        {
            InitializeComponent();
            Loaded += MainPage_Loaded;

            MasterViewModel = new ViewModel();

            var sharedSettings = new ValueSet();

            GazeSettingsHelper.RetrieveSharedSettings(sharedSettings).Completed = new AsyncActionCompletedHandler((asyncInfo, asyncStatus) =>
            {
                var gazePointer = GazeInput.GetGazePointer(this);
                gazePointer.LoadSettings(sharedSettings);
            });

            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;

            SetPageMode(PageMode.Run);
            _speechSynthesizer  = new SpeechSynthesizer();
            _mediaElement       = new MediaElement();
            _backgroundBrush    = new SolidColorBrush(Colors.Gray);
            _foregroundBrush    = new SolidColorBrush(Colors.Blue);
            _transparentBrush   = new SolidColorBrush(Colors.Transparent);
            _dwellProgressBrush = (SolidColorBrush)GazeInput.DwellFeedbackProgressBrush;

            gazePointer = GazeInput.GetGazePointer(null);

            Window.Current.CoreWindow.KeyDown += CoreWindow_KeyDown;
        }
Ejemplo n.º 6
0
    /// <summary>
    /// Returns true if it can be released
    /// objectToInteractWith is 
    /// </summary>
    /// <returns></returns>
    public virtual bool OffInteract(GazePointer pointer, Transform objectToInteractWith)
    {
        if (!canInteract) return false;

//        Debug.Log("Off Interact");

        return true;
    }
Ejemplo n.º 7
0
        public static void Start(Form form)
        {
            var device = GazeDevice.Instance;

            _gazePointer = new GazePointer(device, new NonCursor(form));
            _gazePointer.AddRoot(0);
            _gazePointer.IsCursorVisible = true;
        }
Ejemplo n.º 8
0
        private void MainPage_OnLoaded(object sender, RoutedEventArgs e)
        {
            // Set up the a GazePointer object and make it visible on screen
            _gaze = new GazePointer(this);
            _gaze.CursorRadius    = 6;
            _gaze.IsCursorVisible = true;

            _gaze.GazePointerEvent += OnGazePointerEvent;
        }
Ejemplo n.º 9
0
    public virtual void OffHighlight(GazePointer pointer)
    {
        if (!highlightable || !canInteract) return;

        if (highlightManager) highlightManager.OffHighlight();


        // Debug.Log("Off Highlight");
    }
Ejemplo n.º 10
0
    public override bool OnInteract(GazePointer pointer)
    {
        base.OnInteract(pointer);

        isDripping = false;
        StopCoroutine(dripAction);

        return(false);
    }
Ejemplo n.º 11
0
	public override bool OnInteract(GazePointer pointer)
	{
		base.OnInteract(pointer);

		isDripping = false;
		StopCoroutine (dripAction);

		return false;
	}
 public BlankPage1()
 {
     this.InitializeComponent();
     gazePointer       = GazeInput.GetGazePointer(null);
     gazeButtonControl = GazeInput.GetGazeElement(GazeBlock);
     gazeButtonControl = new GazeElement();
     GazeInput.SetGazeElement(GazeBlock, gazeButtonControl);
     gazeButtonControl.StateChanged += GazeButtonControl_StateChanged;
     // Add the object to our dictionary along with a new stopwatch
     stopwatchesByObject.Add(gazeButtonControl, new Stopwatch());
Ejemplo n.º 13
0
    /// <summary>
    /// Returns true if the object is to be grabbed for example grabbing a pen.
    /// Returns false if the object is just a click and that's it
    /// </summary>
    public virtual bool OnInteract(GazePointer pointer)
    {
        if (!canInteract)
        {
            return(false);
        }
//        Debug.Log("On Interact");

        return(false);
    }
Ejemplo n.º 14
0
    public override bool OnInteract(GazePointer pointer)
    {
        var interact = base.OnInteract(pointer);

        if (interact)
        {
            trigger.SetActive(false);
        }

        return(interact);
    }
Ejemplo n.º 15
0
    public override bool OnInteract(GazePointer pointer)
    {
        var interact =  base.OnInteract(pointer);

        if (interact)
        {
            trigger.SetActive(false);
        }

        return interact;
    }
Ejemplo n.º 16
0
    /// <summary>
    /// Returns true if it can be released
    /// objectToInteractWith is
    /// </summary>
    /// <returns></returns>
    public virtual bool OffInteract(GazePointer pointer, Transform objectToInteractWith)
    {
        if (!canInteract)
        {
            return(false);
        }

//        Debug.Log("Off Interact");

        return(true);
    }
Ejemplo n.º 17
0
    public override bool OffInteract(GazePointer pointer, Transform objectToInteractWith)
    {
        base.OffInteract(pointer, objectToInteractWith);

        this.pointer = null;
        gazeAnchor   = null;

        StopAllCoroutines();
        StartCoroutine(MoveToNotGrabbedPosition());

        return(true);
    }
Ejemplo n.º 18
0
        void MainWindow_Closed(object sender, EventArgs e)
        {
            _driveInterface?.Dispose();

            _windowTimerStopwatch?.Stop();

            _gazeToolbarVisiblityTimer?.Stop();

            _eyesOffStopTimer?.Stop();

            GazePointer.DetachAll();

            Application.Current.Shutdown();
        }
Ejemplo n.º 19
0
//    protected IEnumerator FadeInAudio()
//    {
//
//
//
//    }

    public virtual void OnHighlight(GazePointer pointer)
    {
        if (!highlightable || !canInteract)
        {
            return;
        }

        if (highlightManager)
        {
            highlightManager.OnHighlight();
        }

        // Debug.Log("On Highlight");
    }
Ejemplo n.º 20
0
    public override bool OnInteract(GazePointer pointer)
    {
        var interact = base.OnInteract(pointer);

        if (interact)
        {
            if (puzzle && holder)
            {
                holder.FreeDropPosition(dropPosition);
                puzzle.RemoveFromHolder(this);
            }
        }
        // holder = null; // We just removed from the holder

        return(interact);
    }
Ejemplo n.º 21
0
        public MainPage()
        {
            this.InitializeComponent();

            result.SelectionChanged += OnSelectionChanged;

            _hoverBrush = new SolidColorBrush(Colors.IndianRed);

            _gazePointer        = new GazePointer(this);
            _gazePointer.Filter = new OneEuroFilter();

            _gazePointer.CursorRadius    = 5;
            _gazePointer.IsCursorVisible = true;

            _gazePointer.GazePointerEvent += OnGazePointerEvent;
        }
Ejemplo n.º 22
0
    // This will be called by the Gaze pointer after an object is grabbed. 
//    public override void PhysicsUpdate()
//    {
//        if (moveToAnchor || moveToLastPosition) return;
//
//        // anchor.position = gazeAnchor.position;
//    }
//
//    public override void LogicUpdate()
//    {
//        if (moveToAnchor || moveToLastPosition) return;
//
//        anchor.position = gazeAnchor.position;
//    }

    public override bool OnInteract(GazePointer pointer)
    {
        base.OnInteract(pointer);

        this.pointer = pointer;
        this.gazeAnchor = pointer.Anchor;

        //        myRigidbody.isKinematic = false;

        beforeMovePosition = transform.position;


        StopAllCoroutines();
        StartCoroutine(MoveToAnchorPosition());

        return true;
    }
Ejemplo n.º 23
0
    public override bool OnInteract(GazePointer pointer)
    {
        var interact = base.OnInteract(pointer);

        if (interact)
        {
            if (puzzle && holder)
            {
                holder.FreeDropPosition(dropPosition);
                puzzle.RemoveFromHolder(this);
            }

        }
        // holder = null; // We just removed from the holder

        return interact;
    }
Ejemplo n.º 24
0
    // This will be called by the Gaze pointer after an object is grabbed.
//    public override void PhysicsUpdate()
//    {
//        if (moveToAnchor || moveToLastPosition) return;
//
//        // anchor.position = gazeAnchor.position;
//    }
//
//    public override void LogicUpdate()
//    {
//        if (moveToAnchor || moveToLastPosition) return;
//
//        anchor.position = gazeAnchor.position;
//    }

    public override bool OnInteract(GazePointer pointer)
    {
        base.OnInteract(pointer);

        this.pointer    = pointer;
        this.gazeAnchor = pointer.Anchor;

        //        myRigidbody.isKinematic = false;

        beforeMovePosition = transform.position;


        StopAllCoroutines();
        StartCoroutine(MoveToAnchorPosition());

        return(true);
    }
Ejemplo n.º 25
0
        public virtual void Install(bool reset)
        {
#if UNITY_EDITOR
            if (pointerPrefab == null)
            {
                pointerPrefab = ResourceExt.EditorLoadAsset <GameObject>("Assets/Juniper/Assets/Prefabs/Rigs/DiskProbe2018.2.prefab");
            }

            if (laserPointerNormalMaterial == null)
            {
                laserPointerNormalMaterial = ResourceExt.EditorLoadAsset <Material>("Assets/Juniper/Assets/Materials/LaserPointer_White.mat");
            }

            if (laserPointerEnabledMaterial == null)
            {
                laserPointerEnabledMaterial = ResourceExt.EditorLoadAsset <Material>("Assets/Juniper/Assets/Materials/LaserPointer_Green.mat");
            }

            if (laserPointerDisabledMaterial == null)
            {
                laserPointerDisabledMaterial = ResourceExt.EditorLoadAsset <Material>("Assets/Juniper/Assets/Materials/LaserPointer_Red.mat");
            }
#endif

            Find.Any(out stage);

            stage.Install(reset);
            stage.IndependentHead = HasFloorPosition;

            Gaze   = MakePointer <GazePointer>(stage.Head, "GazePointer");
            Mouse  = MakePointer <Mouse>(stage.Head, "Mouse");
            Helper = MakePointer <NetworkPointer>(stage.Hands, "Network");

            Touches = new TouchPoint[10];
            for (var i = 0; i < Touches.Length; ++i)
            {
                Touches[i]          = MakePointer <TouchPoint>(stage.Head, $"Touches/TouchPoint{i.ToString()}");
                Touches[i].fingerID = i;
            }

            Controllers = MotionController.MakeControllers(MakeHandPointer <MotionController>);
            Hands       = HandTracker.MakeControllers(MakeHandPointer <HandTracker>);

            Voice = this.FindClosest <KeywordRecognizer>();
        }
Ejemplo n.º 26
0
        // Button interactivity for Eye Gaze
        private void OnGazePointerEvent(GazePointer sender, GazePointerEventArgs ea)
        {
            // Figure out what part of the GUI is currently being gazed upon
            UIElement _temp   = ea.HitTarget;
            var       _button = _temp as Button;

            // Eyes Off event
            if (_temp == null && _controlsEnabled)
            {
                Debug.WriteLine("Eyes Off Event!");
                Stop();
            }
            // Button Selection event
            else if (_button != null)
            {
                switch (ea.State)
                {
                case GazePointerState.Fixation:
                    if (_button.Equals(PauseButton) || _button.Equals(SettingsButton) || _button.Equals(ExitButton))
                    {
                        return;
                    }
                    Button_Handler(_button);
                    break;

                case GazePointerState.Dwell:
                    switch (_button.Name)
                    {
                    case "PauseButton":
                        PausePress();
                        break;

                    case "SettingsButton":
                        SettingsPress();
                        break;

                    case "ExitButton":
                        ExitPress();
                        break;
                    }
                    break;
                }
            }
        }
Ejemplo n.º 27
0
        // Button interactivity for Eye Gaze
        private void OnGazePointerEvent(GazePointer sender, GazePointerEventArgs ea)
        {
            // Figure out what part of the GUI is currently being gazed upon
            UIElement _temp = ea.HitTarget;

            // Eyes Off event
            if (_temp == null)
            {
                Debug.WriteLine("Settings: Eyes Off Event!");
            }
            // Button Selection event
            var _button = _temp as Button;

            if (_button != null)
            {
                switch (ea.State)
                {
                case GazePointerState.Fixation:
                    if (_button.Equals(ExitButton) || _button.Equals(SaveButton) || _button.Equals(CloseButton))
                    {
                        return;
                    }
                    Button_Handler(_button);
                    break;

                case GazePointerState.Dwell:
                    switch (_button.Name)
                    {
                    case "ExitButton":
                        StateChange(ControlStates.Goodbye, ExitPress, _button);
                        break;

                    case "CloseButton":
                        StateChange(ControlStates.Goodbye, ClosePress, _button);
                        break;

                    case "SaveButton":
                        StateChange(ControlStates.Default, SavePress, _button);
                        break;
                    }
                    break;
                }
            }
        }
Ejemplo n.º 28
0
    public override bool OnInteract(GazePointer pointer)
    {
        base.OnInteract(pointer);

        this.pointer    = pointer;
        this.gazeAnchor = pointer.Anchor;

        placement = null;

        beforeMovePosition = transform.position;

        transform.parent = initParent;

        if (placed)
        {
            if (startAudioSource && customLoopStartAudio)
            {
//                StopCoroutine(CustomLoopAudio());
//                Debug.Log("Starting Custom Loop Audio");
                if (!doCustomLoopAudio)
                {
                    StartCoroutine(CustomLoopAudio());
                }
            }
            else if (startAudioSource && !startAudioSource.isPlaying)
            {
                startAudioSource.Play();
            }

            placed = false;
        }

        StopCoroutine(MoveToAnchorPosition());
        StopCoroutine(MoveToNotGrabbedPosition());

        StartCoroutine(MoveToAnchorPosition());
//
//        if (doCustomLoopAudio)
//        {
//            StartCoroutine(CustomLoopAudio());
//        }

        return(true);
    }
Ejemplo n.º 29
0
    // Use this for initialization
    void Start()
    {
        m_FocusObjectText = GameObject.Find("FocusObjectText3D").GetComponent <TextMesh> ();
        //m_DebugText = GameObject.Find ("DebugText3D").GetComponent<TextMesh> ();
        //m_MoveModeText = GameObject.Find ("MoveModeText3D").GetComponent<TextMesh> ();
        m_FocusGazePointer = GameObject.Find("FocusGazePointer").GetComponent <GazePointer> ();

        //DebugInGUI ("");

        m_PlayerController = gameObject.GetComponent <CharacterController> ();
        if (m_PlayerController == null)
        {
            Debug.LogWarning("VMEPlayerController: No CharacterController attached.");
        }

                #if UNITY_ANDROID
        m_CameraRig = GameObject.Find("Main Camera").GetComponent <Camera> ();
                #else
        Camera[] CameraRigs = transform.GetComponentsInChildren <Camera> ();

        if (CameraRigs.Length == 0)
        {
            Debug.LogWarning("VMEPlayerController: No Camera attached.");
        }
        else if (CameraRigs.Length > 1)
        {
            Debug.LogWarning("VMEPlayerController: More then 1 Camera attached.");
            m_CameraRig = CameraRigs [0];             //still take the first
        }
        else
        {
            m_CameraRig = CameraRigs [0];
        }

        if (!m_CameraRig.isActiveAndEnabled)
        {
            Debug.LogWarning("VMEPlayerController: No Camera attached.");
        }
                #endif

        Debug.Log("CameraRig set to " + m_CameraRig.name);
        CenterRayTracker.Init();
        CenterRayTracker.SetCameraController(ref m_CameraRig);
    }
Ejemplo n.º 30
0
    public override bool OffInteract(GazePointer pointer, Transform objectToInteractWith)
	{
		if (objectToInteractWith && objectToInteractWith != transform)
		{
			objectBelow = objectToInteractWith.GetComponent<GrabbableSizedObject>();

			if (objectBelow)
			{
				dropPosition = objectBelow.transform.position;
			}
		}
		else
		{
			Debug.Log("objectBelow is null");
			objectBelow = null;
		}
		
		return base.OffInteract(pointer, objectToInteractWith);
	}
Ejemplo n.º 31
0
    public override bool OffInteract(GazePointer pointer, Transform objectToInteractWith)
    {
        if (objectToInteractWith && objectToInteractWith != transform)
        {
            objectBelow = objectToInteractWith.GetComponent <GrabbableSizedObject>();

            if (objectBelow)
            {
                dropPosition = objectBelow.transform.position;
            }
        }
        else
        {
            Debug.Log("objectBelow is null");
            objectBelow = null;
        }

        return(base.OffInteract(pointer, objectToInteractWith));
    }
Ejemplo n.º 32
0
    public override bool OnInteract(GazePointer pointer)
    {
        base.OnInteract(pointer);

        this.pointer = pointer;
        this.gazeAnchor = pointer.Anchor;

        placement = null;

        beforeMovePosition = transform.position;

        transform.parent = initParent;

        if (placed)
        {
            if (startAudioSource && customLoopStartAudio)
            {
//                StopCoroutine(CustomLoopAudio());
//                Debug.Log("Starting Custom Loop Audio");
                if(!doCustomLoopAudio) StartCoroutine(CustomLoopAudio());
            }
            else if (startAudioSource && !startAudioSource.isPlaying)
            {
                startAudioSource.Play();
            }

            placed = false;
        }

        StopCoroutine(MoveToAnchorPosition());
        StopCoroutine(MoveToNotGrabbedPosition());

        StartCoroutine(MoveToAnchorPosition());
//
//        if (doCustomLoopAudio)
//        {
//            StartCoroutine(CustomLoopAudio());
//        }

        return true;
    }
Ejemplo n.º 33
0
    public override bool OffInteract(GazePointer pointer, Transform objectToInteractWith)
    {
        if (objectToInteractWith)
        {
            holder = objectToInteractWith.GetComponent <ScribblerHolder>();

            if (holder)
            {
                holder.puzzle.PutInHolder(this, holder);

                dropPosition = holder.GetFreeDropPosition();
            }
        }
        else
        {
            Debug.Log("objectToInteractWith is null");
            holder = null;
        }

        return(base.OffInteract(pointer, objectToInteractWith));
    }
Ejemplo n.º 34
0
    public override bool OffInteract(GazePointer pointer, Transform objectToInteractWith)
    {
        if (objectToInteractWith)
        {
            holder = objectToInteractWith.GetComponent<ScribblerHolder>();

            if (holder)
            {
                holder.puzzle.PutInHolder(this, holder);

                dropPosition = holder.GetFreeDropPosition();
            }
        }
        else
        {
            Debug.Log("objectToInteractWith is null");
            holder = null;
        }

        return base.OffInteract(pointer, objectToInteractWith);
    }
Ejemplo n.º 35
0
    public override bool OffInteract(GazePointer pointer, Transform objectToInteractWith)
    {
        base.OffInteract(pointer, objectToInteractWith);

        this.pointer = null;
        gazeAnchor   = null;

        if (objectToInteractWith != null)
        {
            placement = objectToInteractWith.GetComponent <GrabbedInteractablePlacement>();

            if (placement != null)
            {
            }
        }

//        StopAllCoroutines();

        StopCoroutine(MoveToAnchorPosition());
        StopCoroutine(MoveToNotGrabbedPosition());
        StartCoroutine(MoveToNotGrabbedPosition());

        return(true);
    }
Ejemplo n.º 36
0
 private void MainWindow_Loaded(object sender, RoutedEventArgs e)
 {
     _pointer = GazePointer.Attach(this, null, GetGazeClickParameters, AppSettings.Instance.Mouse);
 }
Ejemplo n.º 37
0
 static void CalibrateAction(object o)
 {
     GazePointer.LaunchRecalibration();
 }
Ejemplo n.º 38
0
 private void SettingsWindow_Loaded(object sender, RoutedEventArgs e)
 {
     GazePointer.Attach(sender as Window, null, null, AppSettings.Instance.Mouse, true);
 }
Ejemplo n.º 39
0
 private void MainWindow_OnClosing(object sender, CancelEventArgs cancelEventArgs)
 {
     GazePointer.DetachAll();
 }
Ejemplo n.º 40
0
    public override bool OffInteract(GazePointer pointer, Transform objectToInteractWith)
    {
        base.OffInteract(pointer, objectToInteractWith);

        this.pointer = null;
        gazeAnchor = null;

        StopAllCoroutines();
        StartCoroutine(MoveToNotGrabbedPosition());

        return true;
    }
Ejemplo n.º 41
0
 public override bool OnInteract(GazePointer pointer)
 {
     turnedOn = !turnedOn;
     Toggle();
     return false;
 }
Ejemplo n.º 42
0
    public override bool OffInteract(GazePointer pointer, Transform objectToInteractWith)
    {
        base.OffInteract(pointer, objectToInteractWith);

        this.pointer = null;
        gazeAnchor = null;

        if (objectToInteractWith != null)
        {
            placement = objectToInteractWith.GetComponent<GrabbedInteractablePlacement>();

            if (placement != null)
            {

            }
        }

//        StopAllCoroutines();

        StopCoroutine(MoveToAnchorPosition());
        StopCoroutine(MoveToNotGrabbedPosition());
        StartCoroutine(MoveToNotGrabbedPosition());

        return true;
    }
Ejemplo n.º 43
0
 private void SettingsWindow_Loaded(object sender, RoutedEventArgs e)
 {
     GazePointer.Attach(sender as Window, null, null, null, true);
     StopAllCameras();
 }
Ejemplo n.º 44
0
 public override bool OnInteract(GazePointer pointer)
 {
     return interactable.OnInteract(pointer);
 }
Ejemplo n.º 45
0
 public override void OnHighlight(GazePointer pointer)
 {
     interactable.OnHighlight(pointer);
 }
Ejemplo n.º 46
0
 public override bool OffInteract(GazePointer pointer, Transform objectToInteractWith)
 {
     return interactable.OffInteract(pointer, objectToInteractWith);
 }