private void Update() { if (criticalError) { SettingsView.Disable(); } CheckFrameRate(); bbScale = new Vector3(driftThreshold / bbScaleDivider, driftThreshold / bbScaleDivider, driftThreshold / bbScaleDivider); if (isLevel && modEnabled) { if (waitThenActiveFireOnce) { StartCoroutine(WaitThenActive()); waitThenActiveFireOnce = false; } if (!activePause && subToResumeFireOnce) { PauseController.didResumeEvent += OnLevelResume; subToResumeFireOnce = false; } #region frame drop detection if (frameDropDetection) { //Plugin.Log.Debug("FR: " + frameRate); // check framerate if (activePause && (frameRate < frameThreshold)) { Pause(); Plugin.Log.Warn("FPS DROP DETECTED"); Plugin.Log.Debug("FPS 1 frame before drop: " + frameRate); SetText("FPS Drop Detected", Color.magenta); } } #endregion #region tracking issues detection if (trackingIssueDetection && activePause) { trackingLossDetected = false; // check saber positions //Debug.Log("x" + rSaberPos.x + " y" + rSaberPos.y + " z" + rSaberPos.z); //Debug.Log("px" + rSaberPos.x + " py" + rSaberPos.y + " pz" + rSaberPos.z); string whichController = "(error getting which controller)"; CheckSaberPos(Frame.First); #region tracking loss detection bool moveOn = false; bool both = false; if (rSaberPos == prevRSaberPos && rSaberRot == prevRSaberRot) { trackingLossDetected = true; whichController = "right"; moveOn = true; } if (lSaberPos == prevLSaberPos && lSaberRot == prevLSaberRot) { trackingLossDetected = true; whichController = "left"; if (moveOn) { both = true; } } if (both) { whichController = "left & right"; } if (activePause && trackingLossDetected) { Plugin.Log.Debug("Tracking issues detected with " + whichController + " controller."); Pause(); SetText("Tracking issues detected with " + whichController + " controller.", Color.yellow); } CheckSaberPos(Frame.Last); #endregion #region drift detection if (attatchColliderScriptFireOnce) { Plugin.Log.Debug("Attatching collider script..."); AttatchColliderScript(); attatchColliderScriptFireOnce = false; } // note the actual area where it pauses is a static function down below! #endregion } if (colliderBBFireOnce) { colliderBBFireOnce = false; CreateBBCollider(); } #endregion } #region drift detection settings if (boundingBoxEnabled) { if (bbFireOnce) { Plugin.Log.Debug("Attempting to make menu bb..."); bbFireOnce = false; try { activeCubeHolder = Instantiate(cubeHolder); } catch (Exception exception) { CriticalErrorHandler(true, 237, exception); } activeCubeHolder.transform.position = new Vector3(0, playerHeight, 0); activeCubeActive = true; } if (activeCubeActive) { activeCubeHolder.transform.localScale = bbScale; activeCubeHolder.transform.position = new Vector3(0, playerHeight, 0); } } #endregion #region diagnostics (this is temporary) if (Input.GetKeyDown(KeyCode.H)) { Diagnose(); } #endregion }