示例#1
0
    void handleGazesHit()
    {
        GameObject candidate = GameObject.Find(candidateName);


        print("handleGazesHit()");

        //handle our gaze
        object ourRaycastHit = GazeMeshModellerFunctions.GazeUpdate(Camera.main.gameObject, candidate, myStrength, myRadius);

        if (ourRaycastHit != null)
        {
            try {
                RaycastHit thisr = (RaycastHit)ourRaycastHit;
                print("gazehit: WE hit something!");
                print(thisr.ToString());
            } catch {
            }
        }

        //handle their gaze
        if (theirCameraObject)
        {
            object theirRaycastHit = GazeMeshModellerFunctions.GazeUpdate(theirCameraObject, candidate, theirStrength, theirRadius);

            if (theirRaycastHit != null)
            {
                print("gazehit: THEY hit something!");
            }
        }
        else
        {
            print("theirCameraObject doesn't exist!!!!");
        }
    }
示例#2
0
    void tryHitForCamera(string c, float s, float r, bool playsound)
    {
        GameObject cameraObject = GameObject.Find(c);
        GameObject candidate    = GameObject.Find(candidateName);

        //handle their gaze
        if (cameraObject)
        {
            RaycastHit rh = GazeMeshModellerFunctions.GazeUpdate(cameraObject, candidate, s, r);
            if (rh.collider != null)
            {
                print("gazehit: " + c + " hit something!");

                if (playsound)
                {
                    print("playing sound");
                    GazeSoundFunctions.PlayRandomHitAtHit(rh);
                }
            }
        }
        else
        {
            print(c + " doesn't exist!!!!");
        }
    }