예제 #1
0
        public static void UpdateLclTransformDebug(NetworkSyncTransform nst, CompressedElement compressedpos, CompressedElement lastSent)
        {
            nst.debugXformGO.transform.position = (nst.cullUpperBits) ?
                                                  NSTCompressVector.OverwriteLowerBits(lastSent, compressedpos).Decompress() :
                                                  compressedpos.Decompress();

            nst.debugXformGO.transform.rotation =
                nst.transform.rotation.CompressQuatToBitsBuffer(nst.rotationElements[0].totalBitsForQuat).DecompressBitBufferToQuat(nst.rotationElements[0].totalBitsForQuat);
        }
예제 #2
0
        public void AddFrameToBuffer(MsgType msgType, CompressedElement compPos, int packetid)
        {
            // If we are writing to the frame as it is mid-lerp - apply the correct upperbits.
            if (packetid == CurrentIndex && msgType.IsPosLowerType())
            {
                compPos = NSTCompressVector.GuessUpperBits(compPos, currentFrame.compPos);
            }

            int numOfFramesFromCurrent = CountFrames(CurrentIndex, packetid);
            // is this frame still a future event for interpolation, or has it already just guessed it?
            bool isStillPending = numOfFramesFromCurrent < halfBufferSize && numOfFramesFromCurrent > 0;
            bool isCurrentFrame = CurrentIndex == packetid;

            frames[packetid].ModifyFrame(msgType, compPos, compPos.Decompress(), Time.time);

            // Set as valid if 1. is not the frame currently rendering 2. is not in the past, unless the buffer is empty then we need to rewind
            SetBitInValidFrameMask(packetid, !isCurrentFrame && (isStillPending || validFrameMask == 0));
        }