Beispiel #1
0
    /// <summary>
    /// Set the default min clip distance.
    /// </summary>
    private void Start()
    {
        _mainCamera = Camera.main;
        if (_mainCamera == null)
        {
            Debug.LogError("Error EyeTrackingFixationComfort._camera is null, disabling script.");
            enabled = false;
            return;
        }

        MLResult result = MLEyes.Start();

        if (!result.IsOk)
        {
            Debug.LogError("Error starting MLEyes, disabling script.");
            enabled = false;
            return;
        }

        // Register Listeners.
        MLEyes.OnFixationDepthViolationOccurred += HandleOnFixationViolationOccurred;
        MLEyes.OnFixationDepthViolationCleared  += HandleOnFixationViolationCleared;

        // Set the initial minimum distance.
        _mainCamera.nearClipPlane = MagicLeapDevice.MinimumNearClipDistance;
    }
Beispiel #2
0
    void Start()
    {
        MLEyes.Start();

        //set the empty gameobject where the line is attached to the camera's position.
        transform.position = Camera.transform.position;

        //Add the line renderer to the scene.
        lineRendererEyes = gameObject.AddComponent <LineRenderer>();

        //The line is added to origo, but should be where the camera is.
        //Debug.Log("Camera.transform.position: " + Camera.transform.position);
        //Debug.Log("Camera.transform.forward: " + Camera.transform.forward);
        //Debug.Log("transform.position: " + transform.position);
        //lineRenderer.transform.localPosition = Vector3.zero;
        ////lineRenderer.SetPosition = Camera.transform.position;
        //Debug.Log("lineRenderer.transform.localPosition: " + lineRenderer.transform.localPosition);

        //If enabled, the points are considered as world space coordinates, instead of being subject to the transform of the GameObject to which this component is attached.
        //lineRenderer.useWorldSpace = false;

        //Works fine and dandy
        lineRendererEyes.material = lineColorEye;
        //lineRenderer.positionCount = lengthOfLineRenderer;
        lineRendererEyes.positionCount = positionsEye.Length;
        lineRendererEyes.startWidth    = 0.05f;
        lineRendererEyes.endWidth      = 0.05f;

        //Not necessary, but turns of the shadows on the lines, to save some processing.
        GetComponent <LineRenderer>().shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
        lineRendererEyes.receiveShadows            = false;
        lineRendererEyes.allowOcclusionWhenDynamic = false;
    }
 void Start()
 {
     MLEyes.Start();
     transform.position = Camera.transform.position + Camera.transform.forward * 2.0f;
     // Get the meshRenderer component
     _meshRenderer = gameObject.GetComponent <MeshRenderer>();
 }
 public void OnDestroy()
 {
     if (IsConnected)
     {
         MLEyes.Stop();
     }
 }
Beispiel #5
0
 //Deinit:
 private void OnDestroy()
 {
     if (MLEyes.IsStarted)
     {
         MLEyes.Stop();
     }
 }
Beispiel #6
0
 private void OnDestroy()
 {
     if (!MLEyes.IsStarted)
     {
         return;
     }
     MLEyes.Stop();
 }
Beispiel #7
0
 /// <summary>
 /// Stops MLEyes if it has been started
 /// </summary>
 public static void Stop()
 {
     #if PLATFORM_LUMIN
     if (MLEyes.IsStarted)
     {
         MLEyes.Stop();
     }
     #endif
 }
Beispiel #8
0
        void Start()
        {
            _eyePositions = new EyePositionBuffer(
                _smoothBufferSize, _smoothBufferConfidenceThreshold);

            _mainCamera = Camera.main;

            MLEyes.Start();
        }
        /// <summary>
        /// Initializes component and start MLEyes.
        /// </summary>
        override protected void OnEnable()
        {
            base.OnEnable();

            if (!MLEyes.Start())
            {
                Debug.LogError("Error WorldRaycastEyes starting MLEyes, disabling script.");
                enabled = false;
                return;
            }
        }
Beispiel #10
0
    // Start is called before the first frame update
    void Start()
    {
        MLEyes.Start();
        // MLInput.OnControllerButtonDown += HandleOnButtonDown;

        conf.text = "";

        rowData.Add("This spreadsheet displays the fixation point vector and time when the eye position was recorded.");

        rowData.Add("Date and Time, x-position, y-position, z-position");
    }
Beispiel #11
0
    /// <summary>
    /// Unregister listeners.
    /// </summary>
    private void OnDestroy()
    {
        // Unregister Listeners.
        MLEyes.OnFixationDepthViolationOccurred -= HandleOnFixationViolationOccurred;
        MLEyes.OnFixationDepthViolationCleared  -= HandleOnFixationViolationCleared;

        if (MLEyes.IsStarted)
        {
            MLEyes.Stop();
        }
    }
Beispiel #12
0
        //----------- MonoBehaviour Methods -----------

        private void Start()
        {
            _camera = Camera.main;
            MLResult result = MLEyes.Start();

            if (!result.IsOk)
            {
                Debug.LogError("Error starting MLEyes, disabling script.");
                enabled = false;
                return;
            }
        }
Beispiel #13
0
    private Vector3 _heading;          // Where the user looking.

    void Start()
    {
        MLEyes.Start();                                                              // Start eye tracking.
        MLInput.Start();                                                             // Start input controller.
        MLInput.OnTriggerDown += HandleOnTriggerDown;                                // Get trigger down event.

        meshRenderer = gameObject.GetComponent <MeshRenderer>();                     // Get the game object.

        PNConfiguration pnConfiguration = new PNConfiguration();                     // Start PubNub

        pnConfiguration.PublishKey   = "pub-c-bb13912e-7007-46ce-a954-74fe4c6cb131"; // YOUR PUBLISH KEY HERE.
        pnConfiguration.SubscribeKey = "sub-c-e14cda48-b857-11e8-b27d-1678d61e8f93"; // YOUR SUBSCRIBE KEY HERE.
        pubnub  = new PubNub(pnConfiguration);
        pn_uuid = pnConfiguration.UUID;                                              // Get the UUID of the PubNub client.

        pubnub.Subscribe()
        .Channels(new List <string>()
        {
            meshRenderer.name     // Subscribe to the channel for the game object.
        })
        .Execute();
        pubnub.SusbcribeCallback += (sender, e) => {
            SusbcribeEventEventArgs message = e as SusbcribeEventEventArgs;
            if (message.Status != null)
            {
                switch (message.Status.Category)
                {
                case PNStatusCategory.PNUnexpectedDisconnectCategory:
                case PNStatusCategory.PNTimeoutCategory:
                    pubnub.Reconnect();
                    break;
                }
            }
            if (message.MessageResult != null)
            {
                // Does the message equal the UUID for this client?
                if (message.MessageResult.Payload.ToString() == pn_uuid) // Message and client UUID are the same.
                {
                    meshRenderer.material = OwnedMaterial;               // The user owns the game object, change material to OwnedMaterial to show.
                    looking = false;
                    owned   = true;
                }
                else                                                // Message and client UUID are NOT the same.
                {
                    if (owned)                                      // Only need to change color if the user owns the game object.
                    {
                        meshRenderer.material = NonFocusedMaterial; // Another user has taken the game object, change material to NonFocusedMaterial to show..
                        owned = false;
                    }
                }
            }
        };
    }
Beispiel #14
0
    void Start()
    {
        MLEyes.Start();
        //transform.position = Camera.transform.position + Camera.transform.forward * 2.0f;
        // Get the meshRenderer component
        _meshRenderer = gameObject.GetComponent <MeshRenderer>();

        hitTime   = 0.0f;
        AdTime    = 0.0f;
        AdVisible = false;

        mask = LayerMask.GetMask("HitPlane");
    }
Beispiel #15
0
        /// <summary>
        // Starts up MLEyes
        /// </summary>
        public static MLResult Start()
        {
            #if PLATFORM_LUMIN
            _result = MLEyes.Start();

            if (!_result.IsOk)
            {
                Debug.LogErrorFormat("Error: MLEyesStarterKit failed starting MLEyes. Reason: {0}", _result);
            }
            #endif

            return(_result);
        }
Beispiel #16
0
    void OnEnable()
    {
        //Debug.Log("Firebase script enabled");
        MLEyes.Start();

        //Get the current session and set CurrentSessionLocal. This is done here in enable to avoid doing it over and over again in update. Less expensive.
        EndSession EndSessionScript = EntireScene.GetComponent <EndSession>();

        CurrentSessionLocal = EndSessionScript.selectedSession;

        //New. We remove newOrgio from the UFO's position. This is so that it moves accordingly to origo. This is so that all three 'systems' eye/head and now target, all uses origo as a base.
        newOrgio = TargetPatternSphere.transform.position;

        //The FixationConfidence could be set somewhere else. Right now it is being set and overwritten three times.
        user.FixationConfidence = MLEyes.FixationConfidence;
    }
Beispiel #17
0
        void Start()
        {
            MLEyes.Start();
            camera             = GameObject.FindWithTag("MainCamera");
            transform.position = camera.transform.position + camera.transform.forward * 5.0f;
            eyes = new string[2];
            LogToFileHelper logger = new LogToFileHelper();

            scn       = SceneManager.GetActiveScene();
            sceneName = scn.name;

            //establishing logger for storing interactions locally as a backup
            StartCoroutine(logger.LogToFileStringArray("log_eye.json", eyes));
            //creating new session
            StartCoroutine(consoler.NewSession("http://" + LoggingConfig.ip_address + ":" + LoggingConfig.port + "/ext/" + LoggingConfig.api_key + "/new_session"));
        }
Beispiel #18
0
        private void Awake()
        {
            _telekinesis = EyeGaze.GetComponent <TelekinesisController>();
            _gazeRay     = EyeGaze.GetComponent <LineRenderer>();
            _gazeBall    = EyeGaze.GetComponentInChildren <MeshRenderer>();

            if (!MagicLeapDevice.IsReady())
            {
                Debug.LogWarning("Disabling MagicBubbles.Scripts.EyeTracking because MagicLeapDevice wasn't ready.");
                return;
            }

            MLEyes.Start();
            if (!MLEyes.IsStarted)
            {
                Debug.LogWarning("Disabling MagicBubbles.Scripts.EyeTracking because MLEyes didn't start.");
            }
        }
Beispiel #19
0
    void Start()
    {
        MLEyes.Start();

        //set the empty gameobject where the line is attached to the camera's position.
        transform.position = Camera.transform.position;

        //"Camera.transform.forward" Returns the direction of current headpose.
        lineRendererHead               = gameObject.AddComponent <LineRenderer>();
        lineRendererHead.material      = lineColorHead;
        lineRendererHead.positionCount = positionsHead.Length;
        lineRendererHead.startWidth    = 0.05f;
        lineRendererHead.endWidth      = 0.05f;
        GetComponent <LineRenderer>().shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
        lineRendererHead.receiveShadows            = false;
        lineRendererHead.allowOcclusionWhenDynamic = false;

        //lineRendererHead.useWorldSpace = false;
    }
Beispiel #20
0
        // Use this for initialization
        void Start()
        {
            var mapper = FindObjectOfType <MLSpatialMapper>();

            mapper.RefreshAllMeshes();
            if (!MLEyes.IsStarted)
            {
                MLEyes.Start();
            }
            if (!MLInput.IsStarted)
            {
                MLInput.Start();
            }
            MLInput.OnControllerButtonDown += OnButtonDown;
            var gen = ActiveGenerator;

            DisableOtherGenerators(gen);
            gen.InitializeGenerator(MainLocator);
        }
Beispiel #21
0
 private void OnDisable()
 {
     MLEyes.Stop();
 }
Beispiel #22
0
 // Stop tracking.
 void OnDestroy()
 {
     MLEyes.Stop();
 }
Beispiel #23
0
 // Start eye tracking.
 void Start()
 {
     MLEyes.Start();
     meshRenderer = gameObject.GetComponent <MeshRenderer>();
 }
Beispiel #24
0
 void OnDestroy()    // Stop eye tracking and inputs.
 {
     MLEyes.Stop();
     MLInput.OnTriggerDown -= HandleOnTriggerDown;
     MLInput.Stop();
 }
 // Start is called before the first frame update
 void Start()
 {
     MLEyes.Start();
 }
        public override void Awake()
        {
            base.Awake();

            startResult = MLEyes.Start();
        }
Beispiel #27
0
 //Init:
 private void Awake()
 {
     MLEyes.Start();
 }
        /// <summary>
        /// Cleans up the component.
        /// </summary>
        override protected void OnDisable()
        {
            MLEyes.Stop();

            base.OnDisable();
        }
Beispiel #29
0
 void OnDestroy()
 {
     MLEyes.Stop();
     //   MLInput.OnControllerButtonDown -= HandleOnButtonDown;
 }
Beispiel #30
0
 private void Start()
 {
     MLEyes.Start();
     transform.position = Camera.transform.position + Camera.transform.forward * 2.0f;
 }