Jump to content

nahkranoth

Members
  • Posts

    10
  • Joined

  • Last visited

Reputation

0 Neutral

Profile Information

  • About me
    Bottle Rocketeer
  1. There is allready a mod that makes new planets: http://forum.kerbalspaceprogram.com/threads/56993-Krag-s-Planet-Factory-New-Planets I can remember reading somewhere on this forum that someone could use parts of that plugin, so maybe you could ask the maker for some insight too?
  2. Aha, thanks, The Dictionary will help me get what I want. I do think the gradual change is going to come in handy so thank you for that in advance too!
  3. Thank you, thats one solution I can wrap my brain around. I see the dictionary is really handy (did not know of it's existence) and a lot easier to use then 2 arrays next to each other. But I guess I did not understand your first answer. Could you elaborate a bit? "Make so that the PartModule saves the initial value of the part it's instance is located on and you're set." I have the feeling that you are trying to tell me that I can do exactly the same as I'm trying to do now with a Dictionary.
  4. I would need an Array because I want this for every part on the vessel the module is attached to. So also all the stock parts / other mod parts attached to the vessel with my module. To clearify I want to accelerate with great speed and the problem is that because every Part has his own drag it tears itself apart. So I set the max_drag of every part on the vessel to low (all the same) and that works. But somehow after the acceleration is done I want to put back the initial maximum_drag of every Part so the vessel will behave like a normal vessel again.
  5. In my code I'm changing the maximum_drag of all the Parts on my Vessel to something low. I would like to save the initial maximum_drag so I can later reset the maximum_drag to it's original state. I could make a Array in my Partmodule to save the value for every Part but that seems a bad solution. Rather I would extend on the Part Class, so I can assign a new float to every Part with the name initial_max_drag. How do I do that? I have not enough knowledge of the inheritance system of C#.
  6. Why would you need Krakensbane? I am also busy developing something similar like you are making (started it before I found your thread) and because I found your thread I decided to take a different path. I can now launch a craft from a cannon and have a super quick acceleration (from 0 to 10.000 m/s in less then a second) and everything stays together. The problem I had that I thought needed Krakensbane was actually that the friction of the parts differ from eachother so the craft gets ripped apart. I solved it by setting the friction of every part to 0.1 when it accelerates and setting it back when done accelerating. Maybe thats also a solution for your problem?
  7. I solved it. Noticed that it had to do with [this.vessel.rigidbody.freezeRotation]. After I removed it, it worked like a charm.
  8. Aha, I got it working thanks to reading. http://wiki.kerbalspaceprogram.com/wiki/Module_code_examples#Useful_geometry_stuff As for the runway, just apply the eastUnit to the SetWorldVelocity(). But! off coarse the next problem arises. As I start accelerating to around 700 m/s just above the surface of kerbin my ship just disappeares. I can see an error in the log: NullReferenceException: Object reference not set to an instance of an object at KerbalScript_1.testModule.OnStart (StartState state) [0x00000] in <filename unknown>:0 at Part.ModulesOnStart () [0x00000] in <filename unknown>:0 at Part+.MoveNext () [0x00000] in <filename unknown>:0 It has something to do with the part im building on (testModule) Here is the code of the class: public class testModule : PartModule { public int timer = 0; public override void OnStart(StartState state) { this.vessel.rigidbody.freezeRotation = true; } public void Update(){ if (this.vessel == FlightGlobals.ActiveVessel) { if (timer <= 350) { Vector3d position = this.vessel.findWorldCenterOfMass(); Vector3d eastUnit = this.vessel.mainBody.getRFrmVel(position).normalized; Vector3d upUnit = (position - this.vessel.mainBody.position).normalized; Vector3d northUnit = Vector3d.Cross(upUnit, eastUnit); //north = up cross east this.vessel.SetWorldVelocity((eastUnit*timer)+(upUnit*timer)); timer++; }else{ this.vessel.rigidbody.freezeRotation = false; } } } }
  9. Figured out that I could use the rigidbody.AddRelativeForce() to apply a force in a relative direction. The problem is that the vessel will destroy itself, because I want to accelerate it quickly and the forces get too big. I have noticed that SetWorldVelocity does not destroy my craft because it does not apply a force to the rigidbody. I have also found the rigidbody.rotation and I found something about converting that Quaternion.eulerAngles soo I could get the rigidbody's rotation too the world and apply it to the SetWorldVelocity in theory. In practice I haven't got that working.
  10. *Edit title: I meant Relative to surface Could someone clearify for me how the axle system works in KSP. Say I would like to move a ship into a certain direction (say the runway for example) how would I know what the Vector3D variables should be. I understand that the ship is standing on the surface and that the vector3D is not an axle that's determined by the surface itself. So I need to get the Vector3D of the body I'm on and use that for replotting my ships direction. I looked it up at http://wiki.kerbalspaceprogram.com/wiki/API:CelestialBody But couldn't really find what I was expecting. Also I'm not sure how to get just one axle of an Vector3D. Something like Vector3D.x does not work. public void Update(){ this.vessel.SetWorldVelocity (x?,y?,z?); } } Would be a happy man if someone could explain it to me.
×
×
  • Create New...