public void LateUpdate() { if (Time.timeSinceLevelLoad < 1f || CameraManager.Instance == null) { return; } //If the Stock Overlay camera is not on or we are in flight cam mode. if (!JSIAdvPodsUtil.StockOverlayCamIsOn && CameraManager.Instance.currentCameraMode == CameraManager.CameraMode.Flight) { //This is a bit of a performance hit, we are checking ALL loaded vessels to filter out NON JSIAdvTransparentPods. //PartstoFilterFromIVADict will contain all loaded vessels that are not JSIAdvTransparentPods, as well as any that are but are too far from the //camera or are set to auto or OFF. for (int j = 0; j < FlightGlobals.VesselsLoaded.Count; ++j) { if (JSIAdvPodsUtil.ValidVslType(FlightGlobals.VesselsLoaded[j])) { for (int i = 0; i < FlightGlobals.VesselsLoaded[j].parts.Count; ++i) { if (FlightGlobals.VesselsLoaded[j].parts[i].internalModel != null && !FlightGlobals.VesselsLoaded[j].parts[i].Modules.Contains("JSIAdvTransparentPod")) { if (!PartstoFilterfromIVADict.Contains(FlightGlobals.VesselsLoaded[j].parts[i])) { PartstoFilterfromIVADict.Add(FlightGlobals.VesselsLoaded[j].parts[i]); } } } } } } }
public void LateUpdate() { if (Time.timeSinceLevelLoad < 1f || CameraManager.Instance == null) { return; } //If the Stock Overlay camera is not on or we are in flight cam mode. if (!StockOverlayCamIsOn && CameraManager.Instance.currentCameraMode == CameraManager.CameraMode.Flight) { //This is a bit of a performance hit, we are checking ALL loaded vessels to filter out NON JSIAdvTransparentPods. //PartstoFilterFromIVADict will contain all loaded vessels that are not JSIAdvTransparentPods, as well as any that are but are too far from the //camera or are set to auto or OFF. foreach (Vessel vsl in FlightGlobals.Vessels.Where(p => p.loaded && JSIAdvPodsUtil.ValidVslType(p))) { foreach (Part part in vsl.parts.Where(vp => vp.internalModel != null)) { if (!part.Modules.Contains("JSIAdvTransparentPod")) { if (!PartstoFilterfromIVADict.Contains(part)) { PartstoFilterfromIVADict.Add(part); } } } } //If the IVA and Main camera transforms are not null (should't be) position and rotate the IVACamera correctly. //if (IVAcameraTransform != null && MaincameraTransform != null && InternalSpace.Instance != null) //{ // IVAcameraTransform.position = InternalSpace.WorldToInternal(MaincameraTransform.position); // IVAcameraTransform.rotation = InternalSpace.WorldToInternal(MaincameraTransform.rotation); // IVAcamera.fieldOfView = Maincamera.fieldOfView; //} } }