Skip to content

Commit

Permalink
Follow stock logic for calculating joint break force and torque
Browse files Browse the repository at this point in the history
  • Loading branch information
siimav committed Jul 24, 2024
1 parent 63763ae commit 9eeb12b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Source/ProceduralFairings/FairingBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,8 @@ private ConfigurableJoint AddStrut(Part p, Part pp, Vector3 anchorOffset)
if (p && p != pp && p.Rigidbody != pp.Rigidbody && pp.Rigidbody is Rigidbody rb &&
p.gameObject.AddComponent<ConfigurableJoint>() is ConfigurableJoint joint)
{
int sizeFactor = (BottomNodeSize + 1) * 2; // Follow the stock PartJoint logic

joint.xMotion = ConfigurableJointMotion.Locked;
joint.yMotion = ConfigurableJointMotion.Locked;
joint.zMotion = ConfigurableJointMotion.Locked;
Expand All @@ -828,8 +830,8 @@ private ConfigurableJoint AddStrut(Part p, Part pp, Vector3 anchorOffset)
joint.angularZMotion = ConfigurableJointMotion.Locked;
joint.projectionDistance = 0.1f;
joint.projectionAngle = 5;
joint.breakForce = p.breakingForce;
joint.breakTorque = p.breakingTorque;
joint.breakForce = sizeFactor * p.breakingForce * PhysicsGlobals.JointBreakForceFactor;
joint.breakTorque = sizeFactor * p.breakingTorque * PhysicsGlobals.JointBreakTorqueFactor;
joint.connectedBody = rb;
joint.anchor = anchorOffset;

Expand Down

0 comments on commit 9eeb12b

Please sign in to comment.