Unstable 0.17.3.0

This commit is contained in:
Juan Pablo Arce
2022-03-22 14:44:12 -03:00
parent cefac171f5
commit 4206f6db42
100 changed files with 1380 additions and 655 deletions
@@ -448,21 +448,18 @@ namespace Barotrauma
movement = TargetMovement;
bool isMoving = movement.LengthSquared() > 0.00001f;
var mainLimb = MainLimb;
if (isMoving)
float t = 0.5f;
if (isMoving && !SimplePhysicsEnabled && CurrentSwimParams.RotateTowardsMovement)
{
float t = 0.5f;
if (!SimplePhysicsEnabled && CurrentSwimParams.RotateTowardsMovement)
Vector2 forward = VectorExtensions.Forward(Collider.Rotation + MathHelper.PiOver2);
float dot = Vector2.Dot(forward, Vector2.Normalize(movement));
if (dot < 0)
{
Vector2 forward = VectorExtensions.Forward(Collider.Rotation + MathHelper.PiOver2);
float dot = Vector2.Dot(forward, Vector2.Normalize(movement));
if (dot < 0)
{
// Reduce the linear movement speed when not facing the movement direction
t = MathHelper.Clamp((1 + dot) / 10, 0.01f, 0.1f);
}
// Reduce the linear movement speed when not facing the movement direction
t = MathHelper.Clamp((1 + dot) / 10, 0.01f, 0.1f);
}
Collider.LinearVelocity = Vector2.Lerp(Collider.LinearVelocity, movement, t);
}
Collider.LinearVelocity = Vector2.Lerp(Collider.LinearVelocity, movement, t);
//limbs are disabled when simple physics is enabled, no need to move them
if (SimplePhysicsEnabled) { return; }
mainLimb.PullJointEnabled = true;