示例#1
0
        //looking at a media dynamic object
        //mediatime is milliseconds since the start of the video
        public static void RecordGazePoint(double timestamp, string objectid, Vector3 localgazepoint, Vector3 hmdpoint, Quaternion hmdrotation, Vector3 gpsloc, float compass, string mediasource, int mediatimeMs, Vector2 uvs, Vector3 floorPos)
        {
            gazebuilder.Append("{");

            JsonUtil.SetDouble("time", timestamp, gazebuilder);
            gazebuilder.Append(",");
            JsonUtil.SetString("o", objectid, gazebuilder);
            gazebuilder.Append(",");
            JsonUtil.SetVector("p", hmdpoint, gazebuilder);
            gazebuilder.Append(",");
            JsonUtil.SetQuat("r", hmdrotation, gazebuilder);
            gazebuilder.Append(",");
            JsonUtil.SetVector("g", localgazepoint, gazebuilder);
            gazebuilder.Append(",");
            JsonUtil.SetString("mediaId", mediasource, gazebuilder);
            gazebuilder.Append(",");
            JsonUtil.SetInt("mediatime", mediatimeMs, gazebuilder);
            gazebuilder.Append(",");
            JsonUtil.SetVector2("uvs", uvs, gazebuilder);

            if (CognitiveVR_Preferences.Instance.TrackGPSLocation)
            {
                gazebuilder.Append(",");
                JsonUtil.SetVector("gpsloc", gpsloc, gazebuilder);
                gazebuilder.Append(",");
                JsonUtil.SetFloat("compass", compass, gazebuilder);
            }
            if (CognitiveVR_Preferences.Instance.RecordFloorPosition)
            {
                gazebuilder.Append(",");
                JsonUtil.SetVector("f", floorPos, gazebuilder);
            }

            gazebuilder.Append("}");
            gazeCount++;
            if (gazeCount >= CognitiveVR_Preferences.Instance.GazeSnapshotCount)
            {
                SendGazeData();
            }
            else
            {
                gazebuilder.Append(",");
            }
            DynamicGazeRecordEvent(timestamp, objectid, localgazepoint, hmdpoint, hmdrotation);
        }