Jump to content

oakwhiz

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by oakwhiz

  1. Does anybody know if it is possible to spawn a single part as a new vessel in orbit, through the tracking station? It seems almost impossible to simply create a new vessel through the API.
  2. I tried the following code but it generates an exception in the chunk of code after "Set orbit params". I can't figure out what I'm doing wrong here. There has got to be a way to create a vessel dynamically. // Find the Kerbin CelestialBody CelestialBody kerbin = null; foreach (CelestialBody aBody in FlightGlobals.Bodies) { if (aBody.name == "Kerbin") { kerbin = aBody; } } // Create a new blank vessel Vessel newVessel = new Vessel(); // Add a part to the vessel Debug.Log("getPartInfoByName"); AvailablePart ap = PartLoader.getPartInfoByName("cupola"); Debug.Log("Instantiate"); UnityEngine.Object obj = UnityEngine.Object.Instantiate(ap.partPrefab); Debug.Log("newPart"); Part newPart = (Part)obj; Debug.Log("rootPart ; parts.Add()"); newPart.gameObject.name = "cupola"; newPart.partInfo = ap; newVessel.rootPart = newPart; newVessel.parts = new List<Part>(); newVessel.parts.Add(newPart); // Set vessel parameters Debug.Log("Set vessel params"); newVessel.Landed = false; newVessel.Splashed = false; newVessel.landedAt = string.Empty; newVessel.situation = Vessel.Situations.ORBITING; newVessel.vesselType = VesselType.Debris; // Set up an orbit for the vessel Debug.Log("Set orbit params"); double utTime = Planetarium.GetUniversalTime(); OrbitPhysicsManager.HoldVesselUnpack(180); // The next line tries to put the debris somewhere around the CelestialBody newVessel.orbit.UpdateFromStateVectors((UnityEngine.Random.onUnitSphere + UnityEngine.Random.insideUnitSphere) * 200000f, UnityEngine.Random.onUnitSphere * 5000f, kerbin, utTime); newVessel.orbit.Init(); newVessel.orbit.UpdateFromUT(utTime); newVessel.orbitDriver.pos = newVessel.orbit.pos.xzy; newVessel.orbitDriver.vel = newVessel.orbit.vel; // Set rotation parameters newVessel.SetRotation(UnityEngine.Random.rotation); newVessel.angularMomentum = Vector3.zero; newVessel.angularVelocity = Vector3.zero; // ??? Debug.Log("GoOnRails"); newVessel.GoOnRails(); Output: Set orbit params [Exception]: NullReferenceException: Object reference not set to an instance of an object
  3. I can't seem to figure out what the procedure is for taking a part and spawning it as a debris object in a particular orbit. I know that debris objects are just vessels, so I'm assuming that I have to create a Vessel, add a Part to the Vessel, add an Orbit to the Vessel, and then create a ProtoVessel from that Vessel. I haven't been able to find any documentation on instantiating a new vessel though. Any pointers as to where I should start?
  4. I haven't tried using the Kethane addon yet so I might not get around to that for a while. However you are welcome to try and edit this part to create your own version.
  5. There is no plugin, it's just a part.cfg file. Added license info.
  6. Spaceport download link: http://kerbalspaceprogram.com/fuel-ejection-port/ Alternative download link: http://minousoft.com/downloads/FuelEjectionPort.zip The Fuel Ejection Port is simply a modified LV-1R engine designed to vent fuel as quickly as possible. Because it does not burn the fuel, it is a very inefficient thruster. Lightweight and sturdy, it is useful in emergency situations. Some possible use cases: Set a few Fuel Ejection Ports to be part of your last stage, and then bind the Abort action group to your Fuel Ejection Ports. When you hit the Abort button, all your fuel will be dumped out. Use Fuel Ejection Ports to assist in separating stages from each other, instead of using the Sepratron I solid rocket booster to do so. Impart a very large and very quick impulse on to part of your spacecraft using a Fuel Ejection Port. Since it is small and provides a large amount of thrust, you can use it to immediately change the direction of your craft. This mod may be used and redistributed freely for any purpose.
×
×
  • Create New...