Skip to content

Commit

Permalink
allow quicker camera transitions for certain scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
Vivero committed May 19, 2020
1 parent dc278de commit b2d140a
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions KerbalVR_Mod/KerbalVR/KerbalVR_Scene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -407,29 +407,29 @@ protected void UpdateCameraPositions() {
}

protected void OnGameSceneSwitchRequested(GameEvents.FromToAction<GameScenes, GameScenes> fromToAction) {
StartCoroutine("TransitionScene");
StartCoroutine(TransitionScene());
}

protected void OnIvaCameraChange(Kerbal kerbal) {
StartCoroutine("TransitionScene");
StartCoroutine(TransitionScene(true));
}

protected void OnCameraChange(CameraManager.CameraMode mode) {
#if DEBUG
Utils.Log("OnCameraChange: " + mode.ToString());
#endif
StartCoroutine("TransitionScene");
StartCoroutine(TransitionScene(true));
}

protected void OnHmdStatusUpdated(bool isRunning) {
// if enabling VR, ensure camera rig is built
if (isRunning) {
BuildVrCameraRig();
}
StartCoroutine("TransitionScene");
StartCoroutine(TransitionScene());
}

protected IEnumerator TransitionScene() {
protected IEnumerator TransitionScene(bool doFastTransition = false) {
#if DEBUG
Utils.Log("TransitionScene: started...");
#endif
Expand Down Expand Up @@ -464,7 +464,12 @@ protected IEnumerator TransitionScene() {
}

// wait some time
yield return new WaitForSeconds(0.5f);
if (doFastTransition) {
yield return null;
}
else {
yield return new WaitForSeconds(0.5f);
}
#if DEBUG
Utils.Log("TransitionScene: set up new cameras...");
#endif
Expand Down

0 comments on commit b2d140a

Please sign in to comment.