Jump to content

m1nd0

Members
  • Posts

    13
  • Joined

  • Last visited

Reputation

7 Neutral

Profile Information

  • About me
    Bottle Rocketeer

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. That works as long as my own orbit is circular. As soon as my eccentricity becomes to far from 0 it stops working. I've had several attempts as most of them seem to work untill I change my orbit and my own eccentricity becomes larger then 0.05. I even tried with only setting the argumentOfPeriapsis, but even then it the new orbit still doesn't make any sence. This is with only argumentOfPeriapsis: This is with LAN and argumentOfperiapsis: As you can see only setting argumentOfperiapsis comes closest but still is far from what it should be. Annother one with LAN and argumentOfperiapsis: From this I can sort of tell the angle is calculated from the center of the orbit. So I'm guessing I will have to do some angle calculations and adjust the LAN based on the offset of the orbit center? This is just a bit to much for me to comprehend.
  2. Thank you for the help, however you now create an orbit around the current vessels orbit. What is need is a fixed circular orbit of 100 kmwhere the new orbit is near the orbit of the reference vessel. So the argument of periapsis (i think) should be something which would make the orbit near the reference vessel. To put in in context. I lift of with my vessel and at some point I'll get near 100km, I want to spawn vessels once you start approaching 100km in a circular orbit at this height near the ascending vessel..
  3. The code above is actually the code KSP uses to create a random orbit around a body. I just added the "nearOrbit" part which I need to implement.
  4. Hey, I'm trying to create an orbit which is X meters above the current orbit. I am however not able to get it to work. This is the code I got so far: private Orbit CreateOrbitAroundAndNear(CelestialBody body, Orbit nearOrbit, int minAltitude, int maxAltitude) { Orbit orbit = new Orbit(); orbit.referenceBody = body; orbit.eccentricity = (double)UnityEngine.Random.Range(0.0001f, 0.01f); orbit.semiMajorAxis = (double)UnityEngine.Random.Range((float)(body.Radius) + (float)minAltitude, (float)(body.Radius) + (float)maxAltitude); orbit.inclination = (double)UnityEngine.Random.Range((-1.0f / 10.0f), 1.0f / 10.0f); orbit.LAN = (double)UnityEngine.Random.Range(0.999f, 1.001f); orbit.argumentOfPeriapsis = (double)UnityEngine.Random.Range(0.999f, 1.001f); orbit.meanAnomalyAtEpoch = (double)UnityEngine.Random.Range(0.999f, 1.001f); orbit.epoch = (double)UnityEngine.Random.Range(0.999f, 1.001f); orbit.Init(); return orbit; } I tried making the LAN, epoch and incination the same as the nearOrbit but that doesn't help much. When I create random orbits till one is close I notice that the almost basically only the semiMajorAxis is close to the original orbit: [LOG 21:42:33.989] LAN My: 115.483481610485 -- NewObj: 1.00026094913483 [LOG 21:42:33.990] Epoch My: 30235055.4039439 -- NewObj: 0.999513447284698 [LOG 21:42:33.990] Inclination My: 0 -- NewObj: -0.0787511840462685 Does anyone have an idea? Main idea is the new orbit should be within 10km of current orbit at a new height.
  5. They don't reload dlls. And even if they did they actually don't use different AppDomains for loading assemblies this means: The current assembly will not unload Created classes won't be destroyed and will keep running (duplicated code) Even if they were to replace their current method: Assembly.LoadFrom(this.path); by a version which would not lock the file (for example): Assembly.Load(File.ReadBytes(this.path)); The new DLL would still not be used for parts and code because the current domain still has the old dll reference.
  6. I started developing KSP this week and one of the things I hated most about it was rebooting KSP constantly. So before I actually developed a plugin I developed a plugin-reloader. Description This tool allows you to reload plugins without the need for restarting KSP. There are some downsides: Only classes which inherit MonoBehaviour and include the attribute KSPAddon will be reloaded. Parts & partmodules will not be reloaded. Custom parts and partmodules won't work when loading a DLL with this (see note1) Only use this for developing/debugging. Since KSP doesn't allow AppDomains each reload loads a second instance of the plugin, therefore increasing the memory usage. But even without part reloading, my development speed is now over 9000. Installation download latest build or build from source and extract to ksp directory remove your plugin.dll from \GameData\YourPlugins\plugins\ (see note1, bottom of this page for part & partmodule code) edit Settings.cfg in "\GameData\PluginReload". open AssemblyInfo.cs in your project and change AssemblyVersion & AssemblyFileVersion to "1.0.0.*". Visual Studio will auto-increment your build, this is the only way to allow reloading of a DLL. Usage Launch your game. Test something. Rebuild the dll, press Reload plugins to reload plugins. ALT+P opens/closes the rebuild menu. Example of settings.cfg PluginSetting { name = Myplugginname path = C:\develop\myplugin\debug\myplugin.dll loadOnce = false methodsAllowedToFail = false } Known issues If your mod uses KSPAddon.Startup.PSystemSpawn this may issues since the solar system is already created at reload. (untested) Probably more Credits Ezriilc (http://www.kerbaltekaerospace.com/). Used hyperedit GUI code as base for GUI. Terms of Use http://creativecommons.org/licenses/by-nc-sa/3.0/ Download Binaries Github Note1: You can leave your plugin in \GameData\ if you need your parts/partmodules in your code. However you MUST put your parts and modules inside a different DLL which loads them. If you place any code that launches (KSPAddon) it won't be unloaded when all plugins are reloaded, and you will wind up with duplicated code being executing. So far I've only testes this with my own plugin and hyperedit. If you experience issues please use github or this forum to report bugs.
×
×
  • Create New...