Jump to content

Create new PatchedConicSolver Object


einsteiner

Recommended Posts

Does anyone know how to create a new PatchedConicSolver object? It seems the only place to get one is from an existing vessel. If I try instantiating one directly none of the fields are initialized.

I am trying to create a tool to let you place maneuver nodes on the orbit of the body you are currently orbiting. Once you have done this it can solve for an ejection burn that will have the desired effect. This would allow you to plan interplanetary transfers more efficiently and accurately than waiting for a launch window and guessing, since you can factor in eccentricity and inclination by adjusting the maneuver, without the high sensitivity of adjusting the node in your own orbit. The idea is similar to the TransX plugin for Orbiter, where you specify your transfer from one planet to another then it tells you how to do the ejection burn.

However, I can see no way to create a node that is on the planet's orbit, instead of your own. I have examined the MechJeb source code, but it only creates maneuver nodes along your own orbit, so it can use Vessel.PatchedConicSolver. I think it would also work to create a dummy vessel that is positioned at the center of the planet and has the same velocity (as long as it doesn't blow up), but I have the same problem of not being able to create an instance of Vessel from scratch.

Link to comment
Share on other sites

Have a Unity API Reference page: http://docs.unity3d.com/Documentation/ScriptReference/GameObject.AddComponent.html

Just add a Vessel component to the body you're orbiting, et voila! At least, it seems that simple... The link I gave you should help. :) Be sure to check to see if the Vessel component even exists, or find the equivalent on via Debug.Log(this.vessel.GetComponents<Component>());. What that'll do is tell you all the components on the vessel gameObject so you can figure out what component is the right one to add to the planet.

You could also create the dummy vessel at the planet's center and do that, it's just a matter of keeping the dummy at the planet's location and is less likely to cause your game to derp out and break. :P

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...