From 67568457818c592d7a324d4f6015ea4eba9e6726 Mon Sep 17 00:00:00 2001 From: ihsoft Date: Sat, 4 Feb 2017 02:30:51 -0800 Subject: [PATCH] Align cable ends to the attach nodes --- Source/modules/KASModuleCableJoint.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/modules/KASModuleCableJoint.cs b/Source/modules/KASModuleCableJoint.cs index 03cdd71f..51c41cba 100644 --- a/Source/modules/KASModuleCableJoint.cs +++ b/Source/modules/KASModuleCableJoint.cs @@ -83,7 +83,7 @@ float maxJointDistance { /// Gets current distance between the joint ends. float currentJointDistance { get { - return Vector3.Distance(linkSource.nodeTransform.position, linkTarget.nodeTransform.position); + return Vector3.Distance(linkSource.nodeTransform.position, linkTarget.nodeTransform.position); } } @@ -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(); @@ -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.connectedBody = target.part.rb;