(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:
@@ -561,17 +561,14 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (var gap in ConnectedGaps.Where(gap => gap.Open > 0))
|
||||
{
|
||||
//var pos = gap.Position - body.Position;
|
||||
var distance = MathHelper.Max(Vector2.DistanceSquared(item.Position, gap.Position)/1000, 1f);
|
||||
|
||||
//pos.Normalize();
|
||||
item.body.ApplyForce((gap.LerpedFlowForce/distance) * deltaTime);
|
||||
var distance = MathHelper.Max(Vector2.DistanceSquared(item.Position, gap.Position) / 1000, 1f);
|
||||
item.body.ApplyForce((gap.LerpedFlowForce / distance) * deltaTime, maxVelocity: NetConfig.MaxPhysicsBodyVelocity);
|
||||
}
|
||||
}
|
||||
|
||||
public void Extinguish(float deltaTime, float amount, Vector2 position)
|
||||
{
|
||||
for (int i = FireSources.Count - 1; i >= 0; i-- )
|
||||
for (int i = FireSources.Count - 1; i >= 0; i--)
|
||||
{
|
||||
FireSources[i].Extinguish(deltaTime, amount, position);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user