Added a bunch of error checks to physicsbody-manipulating code

This commit is contained in:
Joonas Rikkonen
2018-07-20 16:33:12 +03:00
parent f0a663bab0
commit faf0a87cfa
4 changed files with 100 additions and 19 deletions
@@ -368,8 +368,8 @@ namespace Barotrauma
foreach (var joint in LimbJoints)
{
joint.BodyB.SetTransform(
joint.BodyA.Position + (joint.LocalAnchorA - joint.LocalAnchorB)*0.1f,
joint.LimbB?.body?.SetTransform(
joint.BodyA.Position + (joint.LocalAnchorA - joint.LocalAnchorB) * 0.1f,
(joint.LowerLimit + joint.UpperLimit) / 2.0f);
}
@@ -394,7 +394,7 @@ namespace Barotrauma
Limb torso = GetLimb(LimbType.Torso);
Limb head = GetLimb(LimbType.Head);
MainLimb = torso == null ? head : torso;
MainLimb = torso ?? head;
}
public void AddJoint(XElement subElement, float scale = 1.0f)