Home Forums Software Development Problem with GazeAware Interactors

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #323
    Anonymous
    Inactive

    Hi,

    I´m currently working on a project, which involves Tobii-Eyetracker and Unity3D. So I decided to use the new EyeX SDK.

    Recently I faced the followig problem:

    I have 2 cubes in my scene. If one of the cubes is in focus, i´d like to move both cubes forwards. If cubes are not in focus, i want them to jump back to the start position.

    If I append this script to both cubes, it works out only with one of the objects with the higher ID-Value. It looks that there is no possibility of 2 interactors influencing each other or am I wrong?

    I hope I could face my problem clearly.

    This is how my Skript looks like:

    using Tobii.EyeX.Client;
    using Tobii.EyeX.Client.Interop;
    using Tobii.EyeX.Framework;
    using UnityEngine;
    using System;
    
    public class MoveOnGaze: EyeXInteractorBase
    {
        public Vector3 NormalPosition; 
        public Vector3 EndPosition;  
    
        public Vector3 NormalPosition01; 
        public Vector3 EndPosition01;
       
        private bool _hasFocus; 
        public Transform item01;
        
        
        public new void Start()
        {
            NormalPosition = new Vector3(this.transform.position.x,  this.transform.position.y, this.transform.position.z);
            EndPosition = new Vector3(NormalPosition.x, NormalPosition.y, NormalPosition.z - 1.0f); 
         
            NormalPosition01 = new Vector3(item01.transform.position.x, item01.transform.position.y, item01.transform.position.z);
            EndPosition01 = new Vector3(item01.transform.position.x, item01.transform.position.y, item01.transform.position.z - 1.0f);
        }
    
        public new void Update()
        {
            base.Update();
    
            if (_hasFocus) // falls der Focus auf dem Objekt liegt
            {
                this.transform.position = EndPosition;
                item01.transform.position = EndPosition01;
            }
            else
            {
                this.transform.position = NormalPosition;
                item01.transform.position = NormalPosition01;
            }
        }
        
        protected override void OnEyeXEvent(string interactorId, InteractionEvent @event)
        {
            foreach (var behavior in @event.Behaviors)
            {
                GazeAwareEventParams eventData;
                if (behavior.TryGetGazeAwareEventParams(out eventData))
                {
                    _hasFocus = eventData.HasGaze != EyeXBoolean.False;
                }
            }
        }
    }
    #324
    Robert [Tobii]
    Participant

    Hi @IT007,

    Nice that you are up and running with the Unity sample. My guess is that your item01 needs to be changed a GameObject that you get a reference to, e.g like this:

    
    item01 = GameObject.Find("otherCube");
    

    …where ‘otherCube’ is the name of the other GameObject

    #326
    Anonymous
    Inactive

    Hi @Robert@Tobii,

    Thank you for your fast reply!

    It turned out my problem was in using “transform.Position” instead of “transform.localPosition” 🙂

    I´ve got another question conserning Tobii Eye Tracker: Is there any way to get the exact gaze coordinates over the EyeX SDK?

    Thank You!

    #332
    Robert [Tobii]
    Participant

    Great that you managed to fix the transform problem.

    Regarding gaze coordinates in EyeX SDK, you need to set up a so-called Global Interactor to get this kind of data stream that is not tied to any specific region on the screen. In the MinimalGazeDataStream project in MonoSamples.sln this is exemplified. When using this data in Unity, make sure to use the right coordinate system. As suggested in the Developer’s Guide, the ScreenHelpers class in the Unity sample has some useful code for this.

    Good luck with your project! We look forward to see how it goes.

    EDIT (by Jenny@Tobii 13 Mar 2014): Since Unity SDK 0.14 there is a streaming gaze data sample included in the Unity sample code.

    #351
    Anonymous
    Inactive

    Great, thank you for the support!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.