Jump to content

Control From Here- MiniTutorial on making a docking port


Recommended Posts

This is a mini tutorial on how to set the 'control from here' axis and position on a docking port. I wanted to make docking ports that hung off the side of my service modules. When I first loaded it into KSP, if I clicked on the service module and selected "Control From Here" nothing happened... because the game defaults to assuming that the 'control from here' of a part should come from the part's origin, and point in the part's 'up' direction... in this case up the nose of the rocket... exactly the same way that the command module on top of the service module was pointed... and totally the WRONG direction in relation to the docking port. This meant that my RCS didn't move the right way... that Navy Fish's plugin gave me bad data... and that Mechjeb's automatic docking would just slam the nose of my ship 6 meters into the space station you told it to dock with.

You may not need any of this info - if you're making a standalone docking port where the docking axis - the place the other ship will be that you want to dock with' is 'straight up from the part' then control from here will automatically go the right direction. This will hold true no matter how you attach that docking port to the ship - whichever way was 'up' when you first grabbed the part in the VAB will be where the 'control from here' points. (Just like the stock clamp-o-tron).

But if you're trying to make an inline docking port... or a part where the docking port may be offset from the port's root and/or origin... then you should specify the control axis as well. It's so easy to do that I do it manually for all docking ports, so I never get surprises!

1. The magic happens in Unity- once you've got your docking port model imported into Unity, you want to go to the top of the window "GameObject" menu and select "Add Empty". This will create an empty gameobject randomly placed in your scene.

2. In the Hierarchy panel (usually on the left side of the screen) you want to drag this new empty gameobject on top of your model and let go - this will make your model the parent for the gameobject.

3. If your empty game object is a long way from the model... you can quickly get them to the same place by selecting the gameobject in the hierarchy window, and then in the Inspector window (usually the top right) under "Transform" set the location to 0,0,0. This will put the game object at the center of your model. (Because the model is the game object's parent!)

4. Fine tune the game object's position - you want it lined up with the center of the docking port, and sitting right on the surface of the part. I'm not sure if that's clear enough - I may get around to adding a picture later... but... If you're standing outside the ship, facing your docking port(as in, standing in a position where you'd be squished between the vessels if another ship came to dock with your port right now), and I told you to stick your chewing gum right in the middle of the docking port... your gum would be stuck right where you want the game object to be. (Astronaut's note: Sticking chewing gum to precision and mission critical components such as docking ports is generally a poor idea and will likely void the warranty on both your docking port and your gum.)

5. Now rotate the game object so the blue arrow, in Unity, is pointing out into space - pointing towards where you were just standing when you DIDN'T put gum all over your spaceship part.

6. Rename this gameobject "dockingNode" . The actual name isn't important as long as it matches the config file, but you've got to keep two nodes straight, so you might as well follow my example! If you MUST name your two nodes Abott and Costello there's no technical reason you can't... but...

7. In the Hierarchy, select your 'dockingNode" object. Right click and "Duplicate" it.

8. Rename the duplicate "controlNode."

9. Rotate the controlNode until the GREEN arrow points out into space. (Towards those obnoxious gum sticking kids that you'd like to crush between the two docking vessels.)

10. Out in your text editor - Add the following code to the .cfg file for your part:

MODULE
{
name = ModuleDockingNode
nodeType = size0
nodeTransformName = dockingNode
controlTransformName = controlNode


}


The nodeTransformName property tells the game what empty game object represents the actual docking mechanism... the controlTransformName sets the 'control from here' position and direction reference.

So you can now load up your part and you're good to go!

Art

Edited by artwhaley
Link to comment
Share on other sites

Great! I'll add it now.

Your title is incomplete.

EDIT.

I just realised something interesting. This thing might allow you to change the control direction arbitrarily for other things like probe cores and command pods. If you'd like to test this out with a few angles on a probe core then this would be a really great tut, and actually might help my Skylon mod a LOT because my control direction needs to be slightly tilted.

Edited by Cpt. Kipard
Link to comment
Share on other sites

I updated the title, I'm not sure if that will break your link or not, Cpt.

And.. on parts that DON'T include a docking port... I'm not sure where you would specify the control transform....

But I can tell you that on a part that was a combination command pod and docking port I animated an empty object in Blender and used that as the control transform, specified in the docking port module .cfg, and it animated the control axis... you could trigger the animation and just watch the navball roll around to reorient to the new heading. It was kind of funny to hold an RCS button down while activating it and watch the ship try to adjust the jets as the control reference changed. If we could figure out where to specify the control transform, this sort of manipulation could be really handy for special purposes - i.e. a lander pod that could operate in a forward referencing mode while flying but switch over to ground reference during landings.

I'll poke around and see if I can find a way to specify a control transform for the whole part.

Link to comment
Share on other sites

It wont break the link. Afaik links only use the the number part.

I'm looking forward to your findings.

EDIT

I've found that this transform is also useful on parts that have multiple docking nodes. Without it the part has multiple "control from here" buttons. IIUC adding the transform allows you to only have one button. I don't know how busy you are, but this is another thing you can test out and add to the tutorial if you want.

EDIT

You can try placing the transform in the ModuleCommand module.

Edited by Cpt. Kipard
Link to comment
Share on other sites

  • 3 months later...
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...