(8e2e6e4da) Physics error prevention: - Use the ApplyForce/ApplyImpulse method overrides that clamp the resulting velocity to a value (in this case NetConfig.MaxPhysicsBodyVelocity, 64 m/s). Without this, explosions and attacks for example could apply arbitrarily large forces to bodies, causing physics errors in Ragdoll.CheckValidity. - Make sure angular velocity still has a sane value after applying an impulse to a specific point of a collider.

This commit is contained in:
Joonas Rikkonen
2019-04-03 16:21:22 +03:00
parent 5d7dba0f70
commit 0844f1eae4
12 changed files with 87 additions and 39 deletions
@@ -1094,7 +1094,7 @@ namespace Barotrauma
if (flowForce.LengthSquared() > 0.001f)
{
Collider.ApplyForce(flowForce);
Collider.ApplyForce(flowForce, maxVelocity: NetConfig.MaxPhysicsBodyVelocity);
}
if (currentHull == null ||
@@ -1132,7 +1132,7 @@ namespace Barotrauma
if (flowForce.LengthSquared() > 0.001f)
{
limb.body.ApplyForce(flowForce);
limb.body.ApplyForce(flowForce, maxVelocity: NetConfig.MaxPhysicsBodyVelocity);
}
surfaceY = limbHull.Surface;