Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        Vector3 ViewPoint = StandardViewPoint;

        if (PupilTools.IsConnected && PupilTools.IsGazing)
        {
            //marker = GameObject.Find("Gaze_3D");
            GazeCenter = PupilData._2D.GazePosition;
            ViewPoint  = new Vector3(GazeCenter.x, GazeCenter.y, 1f);
        }
        if (controller.PLAYING)
        {
            Ray gazeray = SceneCamera.ViewportPointToRay(ViewPoint);
            //Ray gaze3d = SceneCamera.ScreenPointToRay(marker.transform.position);
            //Debug.DrawRay(gaze3d.origin, gaze3d.direction, Color.green);
            RaycastHit hit;
            if (Physics.Raycast(gazeray, out hit) && hit.collider.CompareTag("Bubble"))
            {
                GazeTime += Time.deltaTime;
                if (GazeTime > 1.0f)
                {
                    bubble = hit.collider.gameObject.GetComponent <BubbleScript>();
                    bubble.SendMessage("Pop");
                    GazeTime = 0.0f;
                }
            }
            else
            {
                GazeTime = 0.0f;
            }
        }
    }
Ejemplo n.º 2
0
    // Fire when trigger on controller clicks
    void Fire(object sender, ClickedEventArgs e)
    {
        Debug.Log("Fired");
        int        layerMask = 1 << 8;
        RaycastHit _hit;

        if (Physics.Raycast(transform.position, transform.forward * 10, out _hit, 10.0f, layerMask))
        {
            _activebubble = _hit.collider.gameObject.GetComponent <BubbleScript>();
            _activebubble.SendMessage("Pop");
        }
    }