Fixed severed limbs coming back together when SimplePhysicsEnabled is toggled off and on

This commit is contained in:
Joonas Rikkonen
2017-06-14 16:25:39 +03:00
parent 65db119158
commit 680204b2cc
@@ -162,15 +162,16 @@ namespace Barotrauma
limb.body.Enabled = !simplePhysicsEnabled; limb.body.Enabled = !simplePhysicsEnabled;
} }
foreach (RevoluteJoint joint in LimbJoints) foreach (LimbJoint joint in LimbJoints)
{ {
joint.Enabled = !simplePhysicsEnabled; joint.Enabled = !joint.IsSevered && !simplePhysicsEnabled;
} }
if (!simplePhysicsEnabled) if (!simplePhysicsEnabled)
{ {
foreach (Limb limb in Limbs) foreach (Limb limb in Limbs)
{ {
if (limb.IsSevered) continue;
limb.body.SetTransform(Collider.SimPosition, Collider.Rotation); limb.body.SetTransform(Collider.SimPosition, Collider.Rotation);
} }
} }