Fixed ragdolls accumulating a large movement value while being dragged (line 902), causing them to launch off with a high velocity when they wake up
+ some cleanup
This commit is contained in:
@@ -64,16 +64,8 @@ namespace Barotrauma
|
|||||||
levitatingCollider = false;
|
levitatingCollider = false;
|
||||||
Collider.FarseerBody.FixedRotation = false;
|
Collider.FarseerBody.FixedRotation = false;
|
||||||
|
|
||||||
/*if (character.IsRemotePlayer)
|
|
||||||
{
|
|
||||||
MainLimb.pullJoint.WorldAnchorB = Collider.SimPosition;
|
|
||||||
MainLimb.pullJoint.Enabled = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{*/
|
|
||||||
Collider.LinearVelocity = (GetLimb(LimbType.Waist).SimPosition - Collider.SimPosition) * 20.0f;
|
Collider.LinearVelocity = (GetLimb(LimbType.Waist).SimPosition - Collider.SimPosition) * 20.0f;
|
||||||
Collider.SmoothRotate(GetLimb(LimbType.Torso).Rotation);
|
Collider.SmoothRotate(GetLimb(LimbType.Torso).Rotation);
|
||||||
//}
|
|
||||||
|
|
||||||
if (stunTimer > 0)
|
if (stunTimer > 0)
|
||||||
{
|
{
|
||||||
@@ -92,43 +84,38 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!character.IsRemotePlayer || true)
|
//re-enable collider
|
||||||
|
if (!Collider.FarseerBody.Enabled)
|
||||||
{
|
{
|
||||||
//re-enable collider
|
var lowestLimb = FindLowestLimb();
|
||||||
if (!Collider.FarseerBody.Enabled)
|
|
||||||
|
Collider.SetTransform(new Vector2(
|
||||||
|
Collider.SimPosition.X,
|
||||||
|
Math.Max(lowestLimb.SimPosition.Y + (Collider.radius + Collider.height / 2), Collider.SimPosition.Y)),
|
||||||
|
Collider.Rotation);
|
||||||
|
|
||||||
|
Collider.FarseerBody.ResetDynamics();
|
||||||
|
Collider.FarseerBody.Enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swimming)
|
||||||
|
{
|
||||||
|
Collider.FarseerBody.FixedRotation = false;
|
||||||
|
}
|
||||||
|
else if (!Collider.FarseerBody.FixedRotation)
|
||||||
|
{
|
||||||
|
if (Math.Abs(MathUtils.GetShortestAngle(Collider.Rotation, 0.0f)) > 0.001f)
|
||||||
{
|
{
|
||||||
var lowestLimb = FindLowestLimb();
|
//rotate collider back upright
|
||||||
|
Collider.AngularVelocity = MathUtils.GetShortestAngle(Collider.Rotation, 0.0f) * 10.0f;
|
||||||
|
|
||||||
Collider.SetTransform(new Vector2(
|
|
||||||
Collider.SimPosition.X,
|
|
||||||
Math.Max(lowestLimb.SimPosition.Y + (Collider.radius + Collider.height / 2), Collider.SimPosition.Y)),
|
|
||||||
Collider.Rotation);
|
|
||||||
|
|
||||||
Collider.FarseerBody.Enabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (swimming)
|
|
||||||
{
|
|
||||||
Collider.FarseerBody.FixedRotation = false;
|
Collider.FarseerBody.FixedRotation = false;
|
||||||
}
|
}
|
||||||
else if (!Collider.FarseerBody.FixedRotation)
|
else
|
||||||
{
|
{
|
||||||
if (Math.Abs(MathUtils.GetShortestAngle(Collider.Rotation, 0.0f)) > 0.001f)
|
Collider.FarseerBody.FixedRotation = true;
|
||||||
{
|
|
||||||
//rotate collider back upright
|
|
||||||
Collider.AngularVelocity = MathUtils.GetShortestAngle(Collider.Rotation, 0.0f) * 10.0f;
|
|
||||||
Collider.FarseerBody.FixedRotation = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Collider.FarseerBody.FixedRotation = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Collider.FarseerBody.Enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (character.LockHands)
|
if (character.LockHands)
|
||||||
{
|
{
|
||||||
@@ -140,12 +127,9 @@ namespace Barotrauma
|
|||||||
rightHand.Disabled = true;
|
rightHand.Disabled = true;
|
||||||
leftHand.Disabled = true;
|
leftHand.Disabled = true;
|
||||||
|
|
||||||
|
|
||||||
Vector2 midPos = waist.SimPosition;
|
Vector2 midPos = waist.SimPosition;
|
||||||
|
|
||||||
Matrix torsoTransform = Matrix.CreateRotationZ(waist.Rotation);
|
Matrix torsoTransform = Matrix.CreateRotationZ(waist.Rotation);
|
||||||
|
|
||||||
|
|
||||||
midPos += Vector2.Transform(new Vector2(-0.3f * Dir, -0.2f), torsoTransform);
|
midPos += Vector2.Transform(new Vector2(-0.3f * Dir, -0.2f), torsoTransform);
|
||||||
|
|
||||||
if (rightHand.pullJoint.Enabled) midPos = (midPos + rightHand.pullJoint.WorldAnchorB) / 2.0f;
|
if (rightHand.pullJoint.Enabled) midPos = (midPos + rightHand.pullJoint.WorldAnchorB) / 2.0f;
|
||||||
@@ -155,9 +139,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
if (Anim != Animation.UsingConstruction) ResetPullJoints();
|
if (Anim != Animation.UsingConstruction) ResetPullJoints();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SimplePhysicsEnabled)
|
if (SimplePhysicsEnabled)
|
||||||
@@ -917,7 +899,7 @@ namespace Barotrauma
|
|||||||
targetLimb.pullJoint.WorldAnchorB = targetLimb.SimPosition - diff;
|
targetLimb.pullJoint.WorldAnchorB = targetLimb.SimPosition - diff;
|
||||||
targetLimb.pullJoint.MaxForce = 10000.0f;
|
targetLimb.pullJoint.MaxForce = 10000.0f;
|
||||||
|
|
||||||
target.AnimController.movement -= diff;
|
target.AnimController.movement = -diff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user