Assets/Deps/emotitron/Network/NST/NSTFrameBuffer.cs
/// <summary>
/// Returns the previous keyframe closest to the specified frame, if none can be found returns the current frame.
/// </summary>
/// <param name="index"></param>
/// <returns>Returns current frame if no keyframes are found.</returns>
Returns the previous keyframe closest to the specified frame, if none can be found returns the current frame.
Returns the previous keyframe closest to the specified frame if none can be found returns the current frame .
public Frame BestPreviousKeyframe(int index)
		{
			for (int i = 1; i < halfBufferSize; i++)
			{
				int offsetIndex = index - i;
				int correctedi = (offsetIndex < 1) ? offsetIndex + frames.Length - 1 : offsetIndex;
				Frame frame = frames[correctedi];
				if (frame.msgType.IsPosKeyType() &&
					Time.time - frame.packetArriveTime < Time.fixedDeltaTime * nst.sendEveryXTick * (i + quaterBufferSize)) 
				{
					return frame;
				}
			}
			DebugX.LogWarning(Time.time + " NST:" + nst.NstId + " " + nst.name + " <color=black>Could not find a recent keyframe in the buffer history, likely very bad internet loss is responsible. Some erratic player movement is possible.</color>");
			return currentFrame;
		}
public Frame BestPreviousKeyframe ( int index ) { for ( int i = 1 ; i < halfBufferSize ; i ++ ) { int offsetIndex = index - i ; int correctedi = ( offsetIndex < 1 ) ? offsetIndex + frames . Length - 1 : offsetIndex ; Frame frame = frames [ correctedi ] ; if ( frame . msgType . IsPosKeyType ( ) && Time . time - frame . packetArriveTime < Time . fixedDeltaTime * nst . sendEveryXTick * ( i + quaterBufferSize ) ) { return frame ; } } DebugX . LogWarning ( Time . time + " " + nst . NstId + " " + nst . name + " " ) ; return currentFrame ; }
Returns the previous keyframe closest to the specified frame, if none can be found returns the current frame.
Returns the previous keyframe closest to the specified frame if none can be found returns the current frame .
//// First try to get best keyframe // rough estimate that the frame came in this round and isn't a full buffer cycle old
Returns current frame if no keyframes are found.
Returns current frame if no keyframes are found .
index
int
None