Exemple #1
0
 void Awake()
 {
     tracker = GameObject.Find("EyeTracker").GetComponent<EyeTracker>();
     if (tracker == null){
         Debug.LogError("Error: Could not find EyeTracker prefab or its EyeTracker component!");
     }
 }
    // Start is called before the first frame update
    void Start()
    {
        if (IsOwner)
        {
            mainCamera         = GameObject.Find("MainCamera");
            transform.position = mainCamera.transform.position;
            eyeTracker         = GameObject.Find("SRanipal").GetComponent <EyeTracker>();
        }

        if (IsServer)
        {
            if (IsOwner)
            {
                GetComponentInChildren <Light>().color = new Color(1f, 0f, 0f);
            }
            else
            {
                GetComponentInChildren <Light>().color = new Color(0f, 1f, 0f);
            }
        }
        else
        {
            if (IsOwner)
            {
                GetComponentInChildren <Light>().color = new Color(0f, 1f, 0f);
            }
            else
            {
                GetComponentInChildren <Light>().color = new Color(1f, 0f, 0f);
            }
        }
    }
Exemple #3
0
 public void StartTracking(EyeTrackerInfo eyeTrackerInfo)
 {
     EyeTracker = eyeTrackerInfo.Factory.CreateEyeTracker();
     EyeTracker.StartTracking();
     EyeTracker.GazeDataReceived += _tracker_GazeDataReceived;
     IsTracking = true;
 }
Exemple #4
0
        public void StopTracking()
        {
            EyeTracker.GazeDataReceived -= _tracker_GazeDataReceived;
            EyeTracker.StopTracking();

            EyeTracker.Dispose();
            IsTracking = false;
        }
    void Start()
    {
        eye = GameObject.Find("__app").GetComponent <EyeTracker>();

        outline              = gameObject.AddComponent <Outline>();
        outline.OutlineMode  = Outline.Mode.OutlineVisible;
        outline.OutlineColor = Random.ColorHSV(0f, 1f, 1f, 1f, 1f, 1f, 1f, 1f); //Rand bright color
        outline.OutlineWidth = parameters.MaxOutlineWidth;
    }
Exemple #6
0
 // Use this for initialization
 void Awake()
 {
     GameObject limitedVisionObject = Instantiate(Resources.Load("Prefab/SightView"), Vector3.zero, Quaternion.identity) as GameObject;
     limitedVisionTransform = limitedVisionObject.transform;
     _tracker = GameObject.Find("EyeTracker").GetComponent<EyeTracker>();
     if (_tracker == null){
         Debug.LogError("Error: Could not find EyeTracker prefab or its EyeTracker component!");
     }
 }
 private void Start()
 {
     // Cache our prefab scripts.
     _eyeTracker    = EyeTracker.Instance;
     _gazeTrail     = GazeTrail.Instance;
     _calibration   = Calibration.Instance;
     _saveData      = ScreenBasedSaveData.Instance;
     _trackBoxGuide = TrackBoxGuide.Instance;
 }
Exemple #8
0
 private void Start()
 {
     eye = GameObject.Find("__app").GetComponent <EyeTracker>();
     lightningVFXObject      = new GameObject();
     lightningVFXObject.name = "lightningVFXObject";
     lightningVFXObject.AddComponent <VisualEffect>();
     lightningVFXObject.GetComponent <VisualEffect>().visualEffectAsset = vfxAsset;
     lightningVFXObject.GetComponent <VisualEffect>().Stop(); //Prevert play on start
 }
        private void Clean()
        {
            if (swipeGestureRecognizer != null)
            {
                swipeGestureRecognizer.OnGestureDetected -= OnGestureDetected;
            }

            if (audioManager != null)
            {
                audioManager.Dispose();
                audioManager = null;
            }

            if (parallelCombinedGestureDetector != null)
            {
                parallelCombinedGestureDetector.Remove(swipeGestureRecognizer);
                parallelCombinedGestureDetector.Remove(circleGestureRecognizer);
                parallelCombinedGestureDetector.Remove(triangleGestureRecognizer);

                parallelCombinedGestureDetector = null;
                //Add Triangle
            }

            CloseGestureDetector();

            ClosePostureDetector();

            if (voiceCommander != null)
            {
                voiceCommander.OrderDetected -= voiceCommander_OrderDetected;
                voiceCommander.Stop();
                voiceCommander = null;
            }

            if (recorder != null)
            {
                recorder.Stop();
                recorder = null;
            }

            if (eyeTracker != null)
            {
                eyeTracker.Dispose();
                eyeTracker = null;
            }

            if (kinectSensor != null)
            {
                kinectSensor.DepthFrameReady    -= kinectSensor_DepthFrameReady;
                kinectSensor.SkeletonFrameReady -= kinectRuntime_SkeletonFrameReady;
                kinectSensor.ColorFrameReady    -= kinectRuntime_ColorFrameReady;
                kinectSensor.Stop();
                kinectSensor = null;
            }
        }
Exemple #10
0
 public IEnumerator CheckVisibility()
 {
     if (eye == null)
     {
         eye = GameObject.Find("__app").GetComponent <EyeTracker>();
     }
     while (canBePaused)
     {
         Vector3 vecFromCam = transform.position - Camera.main.transform.position;
         paused = Vector3.Angle(vecFromCam, eye.lookDirection) > viewAngle;
         yield return(new WaitForSeconds(0.1f));
     }
 }
Exemple #11
0
    // Use this for initialization
    void Awake()
    {
        GameObject limitedVisionObject = Instantiate(Resources.Load("Prefab/SightView"), Vector3.zero, Quaternion.identity) as GameObject;
        limitedVisionTransform = limitedVisionObject.transform;
        _tracker = GameObject.Find("EyeTracker").GetComponent<EyeTracker>();
        if (_tracker == null){
            Debug.LogError("Error: Could not find EyeTracker prefab or its EyeTracker component!");
        }

        _maxDistance = Movement_Constant.FAIRY_MIN_DISTANCE*Movement_Constant.FAIRY_MIN_DISTANCE;

        // size control
        lastPosition = new Vector3 (20, 20, -5);
        standtime = 0;
        ///////////////
    }
Exemple #12
0
        public static void Main(string[] args)
        {
            Thread     eventLoopThread = null;
            EyeTracker tracker         = null;

            try
            {
                // connected eye tracker.
                tracker = GetConnectedEyeTracker();

                //  eye tracker event loop.
                eventLoopThread = CreateAndRunEventLoopThread(tracker);

                // Connect to the eye tracker.
                tracker.Connect();

                // Get tracker information.
                var info = tracker.GetDeviceInfo();

                // Print information to the console.
                Console.WriteLine("IS4 Large Peripheral: {0}", info.Model);
                Console.WriteLine("IS404-100107122583: {0}", info.SerialNumber);
                Console.WriteLine("2.26.3-720bfb9: {0}", info.FirmwareVersion);
            }
            finally
            {
                if (eventLoopThread != null)
                {
                    tracker.BreakEventLoop();
                    eventLoopThread.Join();
                }

                if (tracker != null)
                {
                    tracker.Dispose();
                }
            }

            Console.WriteLine();
            Console.WriteLine("Press JAMAL to ESC ");
            Console.ReadKey(true);
        }
Exemple #13
0
        private void Start()
        {
            try
            {
                tracker = new EyeTracker(new Uri("tet-tcp://TX300-010104404713.local."));

                //new Thread(tracker.RunEventLoop) { IsBackground = true }.Start();
                tracker.RunEventLoopOnInternalThread(new CompletionStatusCallback((err) => { Console.WriteLine(err); }));

                tracker.Connect();
                tracker.StartTracking();

                tracker.EyeTrackerError += EyeTrackerError;
                tracker.GazeData += EyeTrackerGazeData;

                IsOnline = true;
            }
            catch
            {
                IsOnline = false;
            }
        }
        public ShoppingPage()
        {
            this.InitializeComponent();

            this.ViewModel = new ShoppingViewModel();

            Window.Current.Activated += CurrentWindowActivationStateChanged;
            this.cameraControl.FilterOutSmallFaces = true;
            this.cameraControl.HideCameraControls();
            this.cameraControl.CameraAspectRatioChanged += CameraControl_CameraAspectRatioChanged;

            try
            {
                eyeTracker = new EyeTracker(SettingsHelper.Instance.EyeTracker);
                // this simply creates the http client, no actual listening
                eyeTracker.StartListening();
                eyeTracker.EyeDirectionEvent += OnEyeDirection;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
            }
        }
        public static void Main(string[] args)
        {
            Uri url = null;

            if (args.Length == 1)
            {
                if (args[0] == "--auto")
                {
                    url = new EyeTrackerCoreLibrary().GetConnectedEyeTracker();
                    if (url == null)
                    {
                        Console.WriteLine("No eye tracker found");
                        return;
                    }
                }
                else if (args[0] == "--list")
                {
                    ListConnectedEyeTrackers();
                    return;
                }
                else
                {
                    url = new Uri(args[0]);
                }
            }
            else
            {
                Console.WriteLine("usage: MinimalTrackerNet {url|--auto|--list}");
                return;
            }

            IEyeTracker tracker = null;
            Thread      thread  = null;

            try
            {
                Console.WriteLine("TobiiGazeCore DLL version: {0}", CoreLibraryVersion());
                Console.WriteLine("Creating eye tracker with url {0}.", url);
                tracker = new EyeTracker(url);

                tracker.EyeTrackerError += EyeTrackerError;
                tracker.GazeData        += EyeTrackerGazeData;

                thread = CreateAndRunEventLoopThread(tracker);

                Console.WriteLine("Connecting...");
                tracker.Connect();
                Console.WriteLine("Connected");

                // Good habit to start by retrieving device info to check that communication works.
                PrintDeviceInfo(tracker);

                Console.WriteLine("Start tracking...");
                tracker.StartTracking();
                Console.WriteLine("Tracking started");

                // Let eye tracker track for 20 s.
                Thread.Sleep(20000);

                Console.WriteLine("Stop tracking...");
                tracker.StopTracking();
                Console.WriteLine("Stopped tracking");

                Console.WriteLine("Disconnecting...");
                tracker.Disconnect();
                Console.WriteLine("Disconnected");
            }
            catch (EyeTrackerException ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                if (thread != null)
                {
                    tracker.BreakEventLoop();
                    thread.Join();
                }

                if (tracker != null)
                {
                    tracker.Dispose();
                }
            }
        }
Exemple #16
0
 private void Start()
 {
     DontDestroyOnLoad(this);
     _eyeTracker = EyeTracker.Instance;
 }
    // Start is called before the first frame update
    void Start()
    {
        cameraWrapper = GameObject.Find("CameraWrapper");
        camera1Pos    = GameObject.Find("Camera1Pos");
        camera2Pos    = GameObject.Find("Camera2Pos");
        player1Pos    = GameObject.Find("Player1Pos");
        player2Pos    = GameObject.Find("Player2Pos");

        if (IsOwner)
        {
            if (isHMD)
            {
                eyeTracker = GameObject.Find("SRanipal").GetComponent <EyeTracker>();
            }

            if (IsServer)
            {
                transform.position = player1Pos.transform.position;
                cameraWrapper.transform.position = camera1Pos.transform.position;
                cameraWrapper.transform.rotation = camera1Pos.transform.rotation;
            }
            else
            {
                transform.position = player2Pos.transform.position;
                cameraWrapper.transform.position = camera2Pos.transform.position;
                cameraWrapper.transform.rotation = camera2Pos.transform.rotation;
            }
        }

        if (IsServer)
        {
            if (IsOwner)
            {
                GetComponentInChildren <Renderer>().material = player1Material;
                GetComponentInChildren <Text>().text         = PLAYER_NAME;
            }
            else
            {
                GetComponentInChildren <Renderer>().material = player2Material;
                GetComponentInChildren <Text>().text         = OTHER_NAME;
            }
        }
        else
        {
            if (IsOwner)
            {
                GetComponentInChildren <Renderer>().material = player2Material;
                GetComponentInChildren <Text>().text         = OTHER_NAME;
            }
            else
            {
                GetComponentInChildren <Renderer>().material = player1Material;
                GetComponentInChildren <Text>().text         = PLAYER_NAME;
            }
        }

        if (IsServer)
        {
            GameObject spotLight = Instantiate(spotlightPrefab, Vector3.zero, Quaternion.identity);
            spotLight.GetComponent <NetworkedObject>().SpawnWithOwnership(GetComponent <NetworkedObject>().OwnerClientId);
            if (IsOwner)
            {
                player1SpotLight = spotLight;
            }
            else
            {
                player2SpotLight = spotLight;
            }
        }
    }
Exemple #18
0
 private void Start()
 {
     eye      = GameObject.Find("__app").GetComponent <EyeTracker>();
     textMesh = gameObject.GetComponent <TextMesh>();
     SetText("");
 }