public void UpdatePrevPosRot(PlayerInfo newPlayerInfo) { if (newPlayerInfo == null || _info == null) { return; } if (noInterpolation) { _info = newPlayerInfo; return; } syncStartInfo = new PlayerInfo(_info); if (syncStartInfo.IsRotNaN()) { syncStartInfo.headRot = Quaternion.identity; syncStartInfo.leftHandRot = Quaternion.identity; syncStartInfo.rightHandRot = Quaternion.identity; syncStartInfo.leftLegRot = Quaternion.identity; syncStartInfo.rightLegRot = Quaternion.identity; syncStartInfo.pelvisRot = Quaternion.identity; Plugin.log.Warn("Start rotation is NaN!"); } if (Mathf.Abs(_info.playerProgress - newPlayerInfo.playerProgress) > 0.1f) { _info.playerProgress = newPlayerInfo.playerProgress; } syncEndInfo = newPlayerInfo; if (syncEndInfo.IsRotNaN()) { syncEndInfo.headRot = Quaternion.identity; syncEndInfo.leftHandRot = Quaternion.identity; syncEndInfo.rightHandRot = Quaternion.identity; syncEndInfo.leftLegRot = Quaternion.identity; syncEndInfo.rightLegRot = Quaternion.identity; syncEndInfo.pelvisRot = Quaternion.identity; Plugin.log.Warn("Target rotation is NaN!"); } syncTime = 0; syncDelay = Time.time - lastSynchronizationTime; if (syncDelay > 0.5f) { syncDelay = 0.5f; } lastSynchronizationTime = Time.time; }
public void UpdatePrevPosRot(PlayerInfo newPlayerInfo) { if (newPlayerInfo == null || _info == null || noInterpolation) { return; } syncTime = 0; syncDelay = Time.time - lastSynchronizationTime; if (syncDelay > 0.5f) { syncDelay = 0.5f; } lastSynchronizationTime = Time.time; syncStartInfo = _info; if (syncStartInfo.IsRotNaN()) { syncStartInfo.headRot = Quaternion.identity; syncStartInfo.leftHandRot = Quaternion.identity; syncStartInfo.rightHandRot = Quaternion.identity; Misc.Logger.Warning("Start rotation is NaN!"); } syncEndInfo = newPlayerInfo; if (syncEndInfo.IsRotNaN()) { syncEndInfo.headRot = Quaternion.identity; syncEndInfo.leftHandRot = Quaternion.identity; syncEndInfo.rightHandRot = Quaternion.identity; Misc.Logger.Warning("Target rotation is NaN!"); } _info.playerProgress = syncEndInfo.playerProgress; }