Merge branch 'master' into new-netcode
Conflicts: Subsurface/Properties/AssemblyInfo.cs Subsurface/Source/Items/Components/DockingPort.cs Subsurface/Source/Items/Components/Signal/Wire.cs Subsurface/Source/Items/Item.cs
This commit is contained in:
@@ -384,24 +384,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);
|
||||
@@ -435,6 +427,8 @@ namespace Barotrauma
|
||||
|
||||
UpdateDrawPosition();
|
||||
|
||||
if (sprite == null) return;
|
||||
|
||||
SpriteEffects spriteEffect = (dir == 1.0f) ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
||||
|
||||
if (GameMain.DebugDraw && !body.Awake)
|
||||
|
||||
Reference in New Issue
Block a user