Beispiel #1
0
    void Update()
    {
        transform.eulerAngles = Vector3.zero;

        if (PupilTools.IsConnected && PupilTools.IsGazing)
        {
            Vector3 gazePosition = new Vector3(PupilData._2D.GazePosition.x, PupilData._2D.GazePosition.y, 0f);
            //Debug.Log(gazePosition);
            Ray ray = CameraEye.ViewportPointToRay(gazePosition);
            Debug.DrawRay(ray.origin, ray.direction * 10, Color.green);

            RaycastHit hit;
            //if (Input.GetMouseButton(0) && Physics.Raycast(cam.ScreenPointToRay (Input.mousePosition), out hit, 1f, (int) collisionLayer))
            if (Physics.Raycast(ray, out hit))
            {
                //Debug.Log("raycasthit");
                if (hit.collider.tag == "CenterScreen")
                {
                    //Debug.Log("CenterScreenCollision");
                    AlertController.centerLooked = true;
                }
                else if (hit.collider.tag == "RightScreen")
                {
                    //Debug.Log("RightScreenCollision");
                    AlertController.rightLooked = true;
                }
                else if (hit.collider.tag == "SmallButtons")
                {
                    //Debug.Log("SmallButtonsCollision");
                    AlertController.smallLooked = true;
                }
                else if (hit.collider.tag == "MediumButtons")
                {
                    //Debug.Log("MediumButtonsCollision");
                    AlertController.medLooked = true;
                }
                else if (hit.collider.tag == "Circles")
                {
                    //Debug.Log("CirclesCollision");
                    AlertController.circlesLooked = true;
                }
                if (capturing)
                {
                    //Debug.Log("Objbect: " + hit.collider.gameObject);
                    //Debug.Log("HitPoint: " + hit.point);
                    Vector3 newPoint = GameObject.Find("mustang").transform.worldToLocalMatrix.MultiplyPoint3x4(hit.point);
                    DataRecorder.AddToRecording(hit, newPoint);
                }

                if (mode == HeatmapMode.ParticleDebug)
                {
                    Vector3 newPoint = gameObject.transform.worldToLocalMatrix.MultiplyPoint3x4(hit.point);

                    Add(newPoint);
                }
                //else
                //	Add (RenderingMeshFilter.transform.localToWorldMatrix.MultiplyPoint3x4 (PositionForUV (Vector2.one - hit.textureCoord) - Vector3.forward * 0.001f));
            }
        }

        if (renderingMaterial != null)
        {
            cam.RenderToCubemap(Cubemap);
        }

        if (Input.GetKeyUp(KeyCode.H))
        {
            capturing = !capturing;
        }
    }