Limiting character movement when collider isn't upright (can't run at full speed if lodged in some tight space), hack-ish way of moving the collider of a character that's being dragged
This commit is contained in:
@@ -60,8 +60,8 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
collider.LinearVelocity = (GetLimb(LimbType.Torso).SimPosition - collider.SimPosition) * 60.0f;
|
collider.LinearVelocity = (MainLimb.SimPosition - collider.SimPosition) * 60.0f;
|
||||||
collider.SmoothRotate(GetLimb(LimbType.Torso).Rotation);
|
collider.SmoothRotate(MainLimb.Rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stunTimer > 0)
|
if (stunTimer > 0)
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
collider.LinearVelocity = (GetLimb(LimbType.Torso).SimPosition - collider.SimPosition) * 60.0f;
|
collider.LinearVelocity = (GetLimb(LimbType.Waist).SimPosition - collider.SimPosition) * 20.0f;
|
||||||
collider.SmoothRotate(GetLimb(LimbType.Torso).Rotation);
|
collider.SmoothRotate(GetLimb(LimbType.Torso).Rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,8 +307,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (onGround && (!character.IsRemotePlayer || GameMain.Server != null))
|
if (onGround && (!character.IsRemotePlayer || GameMain.Server != null))
|
||||||
{
|
{
|
||||||
|
//move slower if collider isn't upright
|
||||||
|
float rotationFactor = (float)Math.Abs(Math.Cos(collider.Rotation));
|
||||||
|
|
||||||
collider.LinearVelocity = new Vector2(
|
collider.LinearVelocity = new Vector2(
|
||||||
movement.X,
|
movement.X * rotationFactor,
|
||||||
collider.LinearVelocity.Y > 0.0f ? collider.LinearVelocity.Y * 0.5f : collider.LinearVelocity.Y);
|
collider.LinearVelocity.Y > 0.0f ? collider.LinearVelocity.Y * 0.5f : collider.LinearVelocity.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -899,15 +902,22 @@ namespace Barotrauma
|
|||||||
targetLimb.pullJoint.Enabled = true;
|
targetLimb.pullJoint.Enabled = true;
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float dist = Vector2.Distance(target.SimPosition, collider.SimPosition);
|
float dist = Vector2.Distance(target.SimPosition, collider.SimPosition);
|
||||||
targetMovement *= MathHelper.Clamp(1.5f - dist, 0.0f, 1.0f);
|
|
||||||
|
//limit movement if moving away from the target
|
||||||
|
if (Vector2.Dot(target.SimPosition - collider.SimPosition, targetMovement)<0)
|
||||||
|
{
|
||||||
|
targetMovement *= MathHelper.Clamp(2.0f - dist, 0.0f, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
target.AnimController.IgnorePlatforms = IgnorePlatforms;
|
target.AnimController.IgnorePlatforms = IgnorePlatforms;
|
||||||
|
|
||||||
if (target.Stun > 0.0f || target.IsDead)
|
if (target.Stun > 0.0f || target.IsUnconscious || target.IsDead)
|
||||||
{
|
{
|
||||||
target.AnimController.TargetMovement = TargetMovement;
|
target.AnimController.TargetMovement = TargetMovement;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,8 +117,6 @@ namespace Barotrauma
|
|||||||
#if WINDOWS
|
#if WINDOWS
|
||||||
MessageBox.Show(message, "Oops! Barotrauma just crashed.", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(message, "Oops! Barotrauma just crashed.", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Sounds.SoundManager.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CrashDump(GameMain game, string filePath, Exception exception)
|
static void CrashDump(GameMain game, string filePath, Exception exception)
|
||||||
|
|||||||
Reference in New Issue
Block a user