Пример #1
0
        //button properties are formated as   ,"buttons":{"input":value,"input":value}
        internal static void WriteDynamicController(DynamicData data, string props, bool writeScale, string jbuttonstates)
        {
            var s = DynamicObjectSnapshot.GetSnapshot();

            s.Id   = data.Id;
            s.posX = data.LastPosition.x;
            s.posY = data.LastPosition.y;
            s.posZ = data.LastPosition.z;
            s.rotX = data.LastRotation.x;
            s.rotY = data.LastRotation.y;
            s.rotZ = data.LastRotation.z;
            s.rotW = data.LastRotation.w;

            if (writeScale)
            {
                s.DirtyScale = true;
                s.scaleX     = data.LastScale.x;
                s.scaleY     = data.LastScale.y;
                s.scaleZ     = data.LastScale.z;
            }
            s.Properties = props;
            props        = null;
            s.Buttons    = jbuttonstates;

            s.Timestamp = Util.Timestamp(FrameCount);

            queuedSnapshots.Enqueue(s);
            tempsnapshots++;
            if (tempsnapshots > CognitiveVR_Preferences.S_DynamicSnapshotCount)
            {
                tempsnapshots    = 0;
                ReadyToWriteJson = true; //mark the coroutine as ready to pull from the queue
            }
        }
Пример #2
0
        internal static void WriteDynamic(DynamicData data, string props, bool writeScale)
        {
            var s = DynamicObjectSnapshot.GetSnapshot();

            s.Id   = data.Id;
            s.posX = data.LastPosition.x;
            s.posY = data.LastPosition.y;
            s.posZ = data.LastPosition.z;
            s.rotX = data.LastRotation.x;
            s.rotY = data.LastRotation.y;
            s.rotZ = data.LastRotation.z;
            s.rotW = data.LastRotation.w;

            if (writeScale)
            {
                s.DirtyScale = true;
                s.scaleX     = data.LastScale.x;
                s.scaleY     = data.LastScale.y;
                s.scaleZ     = data.LastScale.z;
            }
            s.Properties = props;
            s.Timestamp  = Util.Timestamp(FrameCount);

            queuedSnapshots.Enqueue(s);
            tempsnapshots++;
            if (tempsnapshots > CognitiveVR_Preferences.S_DynamicSnapshotCount)
            {
                if (Time.time > NextMinSendTime || tempsnapshots > CognitiveVR_Preferences.S_DynamicExtremeSnapshotCount)
                {
                    NextMinSendTime = Time.time + CognitiveVR_Preferences.S_DynamicSnapshotMinTimer;
                    //check lastSendTimer and extreme batch size
                    tempsnapshots    = 0;
                    ReadyToWriteJson = true; //mark the coroutine as ready to pull from the queue
                }
            }
        }