mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
fix(PlayerControllerBase): Turning is now persisted when AutoRun is enabled.
This commit is contained in:
parent
a154804c1a
commit
c8a2d3d2a8
@ -296,7 +296,11 @@ void HandleTurning(float deltaTime)
|
|||||||
if (moveKeys.TurnRight != KeyCode.None && Input.GetKey(moveKeys.TurnRight))
|
if (moveKeys.TurnRight != KeyCode.None && Input.GetKey(moveKeys.TurnRight))
|
||||||
targetTurnSpeed += maxTurnSpeed;
|
targetTurnSpeed += maxTurnSpeed;
|
||||||
|
|
||||||
|
// If there's turn input or AutoRun is not enabled, adjust turn speed towards target
|
||||||
|
// If no turn input and AutoRun is enabled, maintain the previous turn speed
|
||||||
|
if (targetTurnSpeed != 0f || !controlOptions.HasFlag(ControlOptions.AutoRun))
|
||||||
turnSpeed = Mathf.MoveTowards(turnSpeed, targetTurnSpeed, turnAcceleration * maxTurnSpeed * deltaTime);
|
turnSpeed = Mathf.MoveTowards(turnSpeed, targetTurnSpeed, turnAcceleration * maxTurnSpeed * deltaTime);
|
||||||
|
|
||||||
transform.Rotate(0f, turnSpeed * deltaTime, 0f);
|
transform.Rotate(0f, turnSpeed * deltaTime, 0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user