Unstable 0.17.3.0
This commit is contained in:
+8
-11
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user