Using TrySetLimbPosition when flipping a character to prevent limbs from going through walls, changes to outside->inside teleportation logic
This commit is contained in:
@@ -1169,18 +1169,24 @@ namespace Barotrauma
|
||||
break;
|
||||
}
|
||||
|
||||
Vector2 position = limb.SimPosition;
|
||||
|
||||
if (!limb.pullJoint.Enabled && mirror)
|
||||
{
|
||||
difference = limb.body.SimPosition - torso.SimPosition;
|
||||
difference = Vector2.Transform(difference, torsoTransform);
|
||||
difference.Y = -difference.Y;
|
||||
|
||||
TrySetLimbPosition(limb, limb.SimPosition, torso.SimPosition + Vector2.Transform(difference, -torsoTransform));
|
||||
position = torso.SimPosition + Vector2.Transform(difference, -torsoTransform);
|
||||
|
||||
//TrySetLimbPosition(limb, limb.SimPosition, );
|
||||
}
|
||||
|
||||
float angle = flipAngle ? -limb.body.Rotation : limb.body.Rotation;
|
||||
if (wrapAngle) angle = MathUtils.WrapAnglePi(angle);
|
||||
|
||||
TrySetLimbPosition(limb, RefLimb.SimPosition, position);
|
||||
|
||||
limb.body.SetTransform(limb.body.SimPosition, angle);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user