/// <summary> /// Set the SpaceCenterCam to the location os the current LaunchSite /// </summary> /// <param name="currentSite"></param> internal static void SetSpaceCenterCam(KKLaunchSite currentSite) { if (KerbalKonstructs.focusLastLaunchSite && (currentSite.body.name == ConfigUtil.GetCelestialBody("HomeWorld").name)) { foreach (SpaceCenterCamera2 scCam in Resources.FindObjectsOfTypeAll <SpaceCenterCamera2>()) { Log.Normal("Restting to: " + currentSite.LaunchSiteName); scCam.transform.parent = currentSite.lsGameObject.transform; scCam.transform.position = currentSite.lsGameObject.transform.position; scCam.initialPositionTransformName = currentSite.lsGameObject.transform.name; scCam.pqsName = currentSite.body.name; scCam.rotationInitial = currentSite.InitialCameraRotation; scCam.ResetCamera(); KerbalKonstructs.scCamWasAltered = true; } } else { foreach (SpaceCenterCamera2 scCam in Resources.FindObjectsOfTypeAll <SpaceCenterCamera2>()) { Log.Normal("Restting to KSC"); Upgradeables.UpgradeableObject kscRnD = Resources.FindObjectsOfTypeAll <Upgradeables.UpgradeableObject>().Where(x => x.name == "ResearchAndDevelopment").First(); scCam.transform.parent = kscRnD.gameObject.transform; scCam.transform.position = kscRnD.gameObject.transform.transform.position; scCam.initialPositionTransformName = kscRnD.gameObject.transform.name; scCam.pqsName = ConfigUtil.GetCelestialBody("HomeWorld").name; scCam.rotationInitial = -60; scCam.ResetCamera(); KerbalKonstructs.scCamWasAltered = false; } } if (currentSite.LaunchSiteName == "Runway" || currentSite.LaunchSiteName == "LaunchPad" || currentSite.body.name != ConfigUtil.GetCelestialBody("HomeWorld").name) { foreach (SpaceCenterCamera2 cam in Resources.FindObjectsOfTypeAll(typeof(SpaceCenterCamera2))) { cam.altitudeInitial = 45f; cam.ResetCamera(); } } else { PQSCity sitePQS = currentSite.staticInstance.groupCenter.pqsCity; foreach (SpaceCenterCamera2 cam in Resources.FindObjectsOfTypeAll(typeof(SpaceCenterCamera2))) { double nomHeight = currentSite.body.pqsController.GetSurfaceHeight((Vector3d)sitePQS.repositionRadial.normalized) - currentSite.body.Radius; if (sitePQS.repositionToSphereSurface) { nomHeight += sitePQS.repositionRadiusOffset; } cam.altitudeInitial = 0f - (float)nomHeight; cam.ResetCamera(); Log.Normal("fixed the Space Center camera."); } } SetNextMorningPoint(currentSite); }