Jump to content

Docking ports and part triggers


Recommended Posts

Hi all,

I am trying to decypher docking ports. I imported the clamp-o-tron senior port into Blender and can see that I need a dockingNode transform, and I see the collider for the disk shape, but I am puzzled by the small cylinder that is perpendicular to the part. It appears to be a collider... Do docking ports need a part trigger? If so, what tag should I use in Unity, if any?

Link to comment
Share on other sites

It may be best to post a screenshot.

That being said, based on my experiences in making docking ports, yes, that is most definitely a collider, but no, it doesn't need to be a part trigger - just make sure the collider is convex, and you'll be good to go.

Link to comment
Share on other sites

Sorry about that, I was at work. Ok, I restarted Blender and re-imported the clamp-o-tron sr. This is what I see:

uNygri1.png

Turns out the cylinder I saw was a leftover from other part imports. But, I'm definitely having trouble getting my docking port to work. What I'm finding is that the port won't engage, meaning the magnets won't pull the craft together, and the two crafts won't join together. I'm not sure what the issue is. Here is what the part looks like in Unity:

GbmMZ0k.png

And here is the collider:

K3AFYBY.png

When I use MechJeb to auto-dock, the craft orients correctly (nose forward), and attempts to dock with the corresponding port. it looks like NavyFish's Docking Port Alignment Indicator agrees:

yH9lRCS.png

I'm using the Module code from the clamp-o-tron sr port exactly:

MODULE

{

name = ModuleDockingNode

referenceAttachNode = top

nodeType = size2

}

And my attach nodes:

node_stack_top = 0.0, 0.12, 0.0, 0.0, 1.0, 0.0, 2

node_stack_bottom = 0.0, -0.12, 0.0, 0.0, 1.0, 0.0, 2

node_attach = 0.0, -0.12, 0.0, 0.0, -1.0, 0.0

and attach rules:

// attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision

attachRules = 1,1,1,1,0

Any ideas about what I'm doing wrong? Does the dockingNode transform need a particular orientation I'm missing?

Thanks for the help! :)

Edited by Angel-125
Link to comment
Share on other sites

dockingNode has to be slightly outside of the collider box or the collider will prevent the two dockingNode transforms from reaching each other, and game tries to pull them together forever but never fully docks. or if your dockingNode is too far inside of collider, collider will prevent the node from getting close enough for the magnetic force to kick in at all, and it just looks as if the docking port doesn't work.

I find the ideal way is place the dockingNode flush with the top of visible docking ring, and position the collider slightly below the visible mesh. when the port is docked, the visible mesh clips slightly into the other port so you don't have a tiny gap between them.

there are some additional parameters you can adjust as well

nodeTransformName =           
controlTransformName =
undockEjectionForce = 10f; //how hard the base pushes the undocking vessel when undocking. Haven't tested.
minDistanceToReEngage = 1f; //how far you have to back away before attempting to redock
acquireRange = 0.5f; //how close before magnetic force kicks in between the ports
acquireMinFwdDot = 0.7f; //the max forward angle between the two port's Z axis for acquireForce to kick in. cosine of the angle, 0.7 is roughly 45 degrees
acquireMinRollDot = -3.40282347E+38f; //not sure, haven't tested. don't think it matters since you can dock in any roll angle
acquireForce = 2f; //how strong the magnetic pull is
acquireTorque = 2f; //how strong the force is attempting to align the docking port's Z to the target port's Z axis.
captureRange = 0.06f; //how close the dockingNodes has to be before game considers them "Docked"
captureMinFwdDot = 0.998f; //the max angle between the two ports when docked, cosine of the angle. 1 = cosine 0 degrees
captureMinRollDot = -3.40282347E+38f;
captureMaxRvel = 0.3f; //max rel. velocity to dock and not bounce off.
referenceAttachNode = string.Empty;
nodeType = //two ports of the same type can dock together, can be any string, not restricted to size0, 1, 2, etc.
deployAnimationController = -1; // not sure what deployAnimationController parameters do.
deployAnimationTarget = 1f;

Edited by nli2work
Link to comment
Share on other sites

dockingNode has to be slightly outside of the collider box or the collider will prevent the two dockingNode transforms from reaching each other, and game tries to pull them together forever but never fully docks. or if your dockingNode is too far inside of collider, collider will prevent the node from getting close enough for the magnetic force to kick in at all, and it just looks as if the docking port doesn't work.

I find the ideal way is place the dockingNode flush with the top of visible docking ring, and position the collider slightly below the visible mesh. when the port is docked, the visible mesh clips slightly into the other port so you don't have a tiny gap between them.

there are some additional parameters you can adjust as well

nodeTransformName =           
controlTransformName =
undockEjectionForce = 10f; //how hard the base pushes the undocking vessel when undocking. Haven't tested.
minDistanceToReEngage = 1f; //how far you have to back away before attempting to redock
acquireRange = 0.5f; //how close before magnetic force kicks in between the ports
acquireMinFwdDot = 0.7f; //the max forward angle between the two port's Z axis for acquireForce to kick in. cosine of the angle, 0.7 is roughly 45 degrees
acquireMinRollDot = -3.40282347E+38f; //not sure, haven't tested. don't think it matters since you can dock in any roll angle
acquireForce = 2f; //how strong the magnetic pull is
acquireTorque = 2f; //how strong the force is attempting to align the docking port's Z to the target port's Z axis.
captureRange = 0.06f; //how close the dockingNodes has to be before game considers them "Docked"
captureMinFwdDot = 0.998f; //the max angle between the two ports when docked, cosine of the angle. 1 = cosine 0 degrees
captureMinRollDot = -3.40282347E+38f;
captureMaxRvel = 0.3f; //max rel. velocity to dock and not bounce off.
referenceAttachNode = string.Empty;
nodeType = //two ports of the same type can dock together, can be any string, not restricted to size0, 1, 2, etc.
deployAnimationController = -1; // not sure what deployAnimationController parameters do.
deployAnimationTarget = 1f;

Much appreciated, that definitely helped! Now it's just a matter of fine tuning the settings. Thanks again. :)

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...