Upper limit to water drag force, fixed highlighted items "flickering"
This commit is contained in:
@@ -462,14 +462,14 @@ namespace Barotrauma
|
||||
Vector2 normal = new Vector2(-line.Y, line.X);
|
||||
normal = Vector2.Normalize(-normal);
|
||||
|
||||
float dragDot = Vector2.Dot(normal, velDir);
|
||||
float dragDot = Math.Abs(Vector2.Dot(normal, velDir));
|
||||
Vector2 dragForce = Vector2.Zero;
|
||||
if (dragDot > 0)
|
||||
{
|
||||
float vel = LinearVelocity.Length()*2.0f;
|
||||
float drag = dragDot * vel * vel
|
||||
* ConvertUnits.ToSimUnits(sprite.size.Y);
|
||||
dragForce = drag * -velDir;
|
||||
dragForce = Math.Min(drag, Mass*1000.0f) * -velDir;
|
||||
//if (dragForce.Length() > 100.0f) { }
|
||||
}
|
||||
|
||||
|
||||
@@ -703,6 +703,8 @@ namespace Barotrauma
|
||||
inWater = IsInWater();
|
||||
if (inWater) ApplyStatusEffects(ActionType.InWater, deltaTime);
|
||||
|
||||
isHighlighted = false;
|
||||
|
||||
if (body == null || !body.Enabled) return;
|
||||
|
||||
if (Math.Abs(body.LinearVelocity.X) > 0.01f || Math.Abs(body.LinearVelocity.Y) > 0.01f)
|
||||
@@ -881,7 +883,6 @@ namespace Barotrauma
|
||||
|
||||
if (!editing || (body != null && !body.Enabled))
|
||||
{
|
||||
isHighlighted = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user