Anim tweaking, simplified (+ non-broken) water drag logic
This commit is contained in:
@@ -382,24 +382,16 @@ namespace Barotrauma
|
||||
//buoyancy
|
||||
Vector2 buoyancy = new Vector2(0, Mass * 9.6f);
|
||||
|
||||
//drag
|
||||
Vector2 velDir = Vector2.Normalize(LinearVelocity);
|
||||
|
||||
Vector2 line = new Vector2((float)Math.Cos(body.Rotation), (float)Math.Sin(body.Rotation));
|
||||
line *= Math.Max(height + radius*2, height);
|
||||
|
||||
Vector2 normal = new Vector2(-line.Y, line.X);
|
||||
normal = Vector2.Normalize(-normal);
|
||||
|
||||
float dragDot = Math.Abs(Vector2.Dot(normal, velDir));
|
||||
Vector2 dragForce = Vector2.Zero;
|
||||
if (dragDot > 0)
|
||||
|
||||
if (LinearVelocity.LengthSquared() > 0.00001f)
|
||||
{
|
||||
//drag
|
||||
Vector2 velDir = Vector2.Normalize(LinearVelocity);
|
||||
|
||||
float vel = LinearVelocity.Length() * 2.0f;
|
||||
float drag = dragDot * vel * vel
|
||||
* Math.Max(height + radius * 2, height);
|
||||
dragForce = Math.Min(drag, Mass * 1000.0f) * -velDir;
|
||||
//if (dragForce.Length() > 100.0f) { }
|
||||
float drag = vel * vel * Math.Max(height + radius * 2, height);
|
||||
dragForce = Math.Min(drag, Mass * 500.0f) * -velDir;
|
||||
}
|
||||
|
||||
body.ApplyForce(dragForce + buoyancy);
|
||||
|
||||
Reference in New Issue
Block a user