/// <summary> /// Calculates the forces and torque on a vessel at a given condition at the CoM /// </summary> /// <param name="vessel">Vessel in question</param> /// <param name="aeroForce">Total aerodynamic force at CoM, in kN</param> /// <param name="aeroTorque">Total aerodynamic torque at CoM, in kN * m</param> /// <param name="velocityWorldVector"> /// Velocity vector in world space relative to the atmosphere for CURRENT vessel /// orientation, m/s /// </param> /// <param name="altitude">Vessel altitude, in m</param> public static void CalculateVesselAeroForces( Vessel vessel, out Vector3 aeroForce, out Vector3 aeroTorque, Vector3 velocityWorldVector, double altitude ) { aeroForce = aeroTorque = Vector3.zero; if (vessel == null) { FARLogger.Error("API Error: attempted to simulate aerodynamics of null vessel"); return; } FARVesselAero vesselAero = vessel.GetComponent <FARVesselAero>(); if (vesselAero == null) { FARLogger.Error($"API Error: vessel {vessel} does not have FARVesselAero aerocomponent for simulation"); return; } vesselAero.SimulateAeroProperties(out aeroForce, out aeroTorque, velocityWorldVector, altitude); }
public IEnumerator LoadAsync() { FARLogger.Debug($"Loading asset bundle {BundlePath}"); AssetBundleCreateRequest createRequest = AssetBundle.LoadFromFileAsync(BundlePath); yield return(createRequest); assetBundle = createRequest.assetBundle; if (assetBundle == null) { FARLogger.Error($"Could not load asset bundle from {BundlePath}"); yield break; } AssetBundleRequest loadRequest = assetBundle.LoadAllAssetsAsync(typeof(T)); yield return(loadRequest); foreach (Object asset in loadRequest.allAssets) { FARLogger.Debug($"Adding {asset} to dictionary"); Add(asset.name, (T)asset); } FARLogger.Debug($"Finished loading {typeof(T)} assets from {BundlePath}"); AssetsLoaded = true; OnLoad(); }
public IEnumerator LoadAsync() { FARLogger.Debug(string.Format("Loading asset bundle {0}", BundlePath)); var createRequest = AssetBundle.LoadFromFileAsync(BundlePath); yield return(createRequest); assetBundle = createRequest.assetBundle; if (assetBundle == null) { FARLogger.Error(string.Format("Could not load asset bundle from {0}", BundlePath)); yield break; } var loadRequest = assetBundle.LoadAllAssetsAsync(typeof(T)); yield return(loadRequest); foreach (var asset in loadRequest.allAssets) { FARLogger.Debug(string.Format("Adding {0} to dictionary", asset)); Add(asset.name, (T)asset); } FARLogger.Debug(string.Format("Finished loading {0} assets from {1}", typeof(T), BundlePath)); AssetsLoaded = true; OnLoad(); }
protected override void SetBundlePath(string name) { // ReSharper disable once SwitchStatementMissingSomeCases switch (Application.platform) { case RuntimePlatform.LinuxPlayer: case RuntimePlatform.WindowsPlayer when SystemInfo.graphicsDeviceVersion.StartsWith("OpenGL", StringComparison.Ordinal): FARLogger.Info("Loading shaders from Linux bundle"); name += "_linux"; //For OpenGL users on Windows we load the Linux shaders to fix OpenGL issues break; case RuntimePlatform.WindowsPlayer: FARLogger.Info("Loading shaders from Windows bundle"); name += "_windows"; break; case RuntimePlatform.OSXPlayer: FARLogger.Info("Loading shaders from MacOSX bundle"); name += "_macosx"; break; default: // Should never reach this FARLogger.Error($"Invalid runtime platform {Application.platform}"); break; } base.SetBundlePath(name); }
private void Awake() { PropertyInfo pipelineProperty = typeof(KSPUpgradePipeline).GetProperty("Pipeline", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.IgnoreCase); if (!(pipelineProperty?.GetValue(null) is SaveUpgradePipeline.SaveUpgradePipeline pipeline)) { FARLogger.Error("Could not find SaveUpgradePipeline"); return; } FARLogger.Info("Removing ModuleControlSurface upgrade script from SaveUpgradePipeline"); pipeline.upgradeScripts.RemoveAll(script => script.Name.Contains("ModuleControlSurface")); }