Ragdolls can't be dragged through walls or other colliders. Closes #772

This commit is contained in:
Joonas Rikkonen
2018-09-10 16:14:44 +03:00
parent 34c721bf89
commit 571ed150fe

View File

@@ -1083,8 +1083,31 @@ namespace Barotrauma
}
}
}
Limb pullLimb = i == 0 ? leftHand : rightHand;
if (GameMain.Client == null)
{
//stop dragging if there's something between the pull limb and the target limb
Vector2 sourceSimPos = pullLimb.SimPosition;
Vector2 targetSimPos = targetLimb.SimPosition;
if (character.Submarine != null && character.SelectedCharacter.Submarine == null)
{
targetSimPos -= character.Submarine.SimPosition;
}
else if (character.Submarine == null && character.SelectedCharacter.Submarine != null)
{
sourceSimPos -= character.SelectedCharacter.Submarine.SimPosition;
}
var body = Submarine.CheckVisibility(sourceSimPos, targetSimPos, ignoreSubs: true);
if (body != null)
{
character.DeselectCharacter();
return;
}
}
if (i == 1 && inWater)
{
targetLimb.pullJoint.Enabled = false;