public void enable(GameObject target) { cam = FlightCamera.fetch; if (cam) { active = true; if (KerbalKonstructs.useLegacyCamera) { InputLockManager.SetControlLock(ControlTypes.CAMERACONTROLS, "KKCamControls"); cam.DeactivateUpdate(); oldTarget = cam.transform.parent; //cam.updateActive = false; cam.transform.parent = target.transform; cam.transform.position = target.transform.position; } else { // new camera code cam.SetTargetTransform(target.transform); } } else { Log.UserError("FlightCamera doesn't exist!"); } }
private static void ToMainCamera() { if ((_cam != null) && (_cam.transform != null)) { _cam.transform.parent = _origParent; _cam.transform.localPosition = _origPosition; _cam.transform.localRotation = _origRotation; Camera.main.nearClipPlane = _origClip; _cam.SetFoV(_origFoV); _cam.ActivateUpdate(); if (FlightGlobals.ActiveVessel != null && HighLogic.LoadedSceneIsFlight) { _cam.SetTargetTransform(FlightGlobals.ActiveVessel.transform); } _origParent = null; if (_currentCamera != null) { _currentCamera.ltCamActive = false; } _currentCamera = null; } }
public void resetCamera(Vessel previousVessel) { ReflectedMembers.Initialize(); GameObject.Destroy(fpgui); if (!isFirstPerson) { return; } Vessel pVessel = FlightGlobals.ActiveVessel; FlightCamera flightCam = FlightCamera.fetch; cameraState.recallState(flightCam); if (FlightGlobals.ActiveVessel != null) { flightCam.SetTargetTransform(pVessel.transform); } flightCam.ActivateUpdate(); isFirstPerson = false; EnableRenderingOnPrevious(previousVessel); //Exit first person if (OnExitFirstPerson != null) { OnExitFirstPerson(currentfpeva); } currentfpeva = null; //Restore stuff that changed in the evacontroller if (previousVessel != null && previousVessel.evaController != null) { //Axis control settings ReflectedMembers.eva_manualAxisControl.SetValue(previousVessel.evaController, false); ReflectedMembers.eva_cmdRot.SetValue(previousVessel.evaController, Vector3.zero); //Pack power (from fine controls) previousVessel.evaController.rotPower = 1f; previousVessel.evaController.linPower = 0.3f; } KeyDisabler.instance.restoreAllKeys(KeyDisabler.eDisableLockSource.FirstPersonEVA); }