Skip to content

Commit

Permalink
Merge pull request #7 from JonnyOThan/fix-far-plane
Browse files Browse the repository at this point in the history
store old far plane so it doesn't get progressively shorter
  • Loading branch information
linuxgurugamer authored Aug 1, 2022
2 parents 2478eba + 85daf22 commit 67055b5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ThroughTheEyes/CameraState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class CameraState
private float origMinHeightAtMaxDist=1000f;
private float origMinHeightAtMinDist=.3f;
private float origNearClipPlane = 0.5f;
private float origFarClipPlane;
private Transform origParent = null;

public void saveState(FlightCamera flightCam) {
Expand All @@ -30,6 +31,7 @@ public void saveState(FlightCamera flightCam) {
origMaxDistance = flightCam.maxDistance;
origStartDistance = flightCam.startDistance;
origNearClipPlane = flightCam.mainCamera.nearClipPlane;
origFarClipPlane = flightCam.mainCamera.farClipPlane;
origParent = flightCam.transform.parent;
}

Expand All @@ -46,6 +48,7 @@ public void recallState(FlightCamera flightCam)
flightCam.startDistance = origStartDistance;
flightCam.SetDistanceImmediate(origStartDistance);
flightCam.mainCamera.nearClipPlane = origNearClipPlane;
flightCam.mainCamera.farClipPlane = origFarClipPlane;
flightCam.transform.parent = origParent;
}

Expand Down

0 comments on commit 67055b5

Please sign in to comment.