Ensure pulling maximum length is at least 1 to avoid errors (#4808)

This commit is contained in:
20kdc
2021-10-09 14:49:08 +01:00
committed by GitHub
parent 4f5cbb63de
commit 59277d8f86

View File

@@ -108,9 +108,10 @@ namespace Content.Shared.Pulling
pullable.PullJoint = _jointSystem.CreateDistanceJoint(pullablePhysics.Owner.Uid, pullerPhysics.Owner.Uid, id:$"pull-joint-{pullablePhysics.Owner.Uid}");
pullable.PullJoint.CollideConnected = false;
// This maximum has to be there because if the object is constrained too closely, the clamping goes backwards and asserts.
pullable.PullJoint.MaxLength = Math.Max(1.0f, length);
pullable.PullJoint.Length = length * 0.75f;
pullable.PullJoint.MinLength = 0f;
pullable.PullJoint.MaxLength = length;
pullable.PullJoint.Stiffness = 1f;
// Messaging