Skip to content

Commit

Permalink
Align cable ends to the attach nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
ihsoft committed Feb 4, 2017
1 parent 85fc114 commit 6756845
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Source/modules/KASModuleCableJoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ float maxJointDistance {
/// <summary>Gets current distance between the joint ends.</summary>
float currentJointDistance {
get {
return Vector3.Distance(linkSource.nodeTransform.position, linkTarget.nodeTransform.position);
return Vector3.Distance(linkSource.nodeTransform.position, linkTarget.nodeTransform.position);
}
}

Expand Down Expand Up @@ -185,7 +185,7 @@ void CreateDistanceJoint(ILinkSource source, ILinkTarget target) {
rb.mass = (source.part.mass + target.part.mass) / 2;

// Temporarily align to the source to have spring joint remembered zero length.
jointObj.transform.parent = source.part.transform;
jointObj.transform.parent = source.nodeTransform;
jointObj.transform.localPosition = Vector3.zero;

springJoint = jointObj.AddComponent<SpringJoint>();
Expand All @@ -197,9 +197,9 @@ void CreateDistanceJoint(ILinkSource source, ILinkTarget target) {
springJoint.maxDistance = originalLength;
springJoint.connectedBody = source.part.rb;
springJoint.enablePreprocessing = false;

// Move plug head to the target and adhere it there.
jointObj.transform.parent = target.part.transform;
// Move plug head to the target and adhere it there at the attach node transform.
jointObj.transform.parent = target.nodeTransform;
jointObj.transform.localPosition = Vector3.zero;
var fixedJoint = jointObj.AddComponent<FixedJoint>();
fixedJoint.connectedBody = target.part.rb;
Expand Down

0 comments on commit 6756845

Please sign in to comment.