Skip to content

Commit

Permalink
Improve scope animation while firing in ADS
Browse files Browse the repository at this point in the history
  • Loading branch information
timmybo5 committed Sep 13, 2023
1 parent 37de22b commit 74dfb0d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion code/swb_base/ViewModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private void HandleWalkAnimation()
else if (localVel.x < 0.0f)
yaw = 3.0f * (localVel.x / maxWalkSpeed);

// Check if firing
// Check if ADS & firing
if (weapon.IsZooming && weapon.TimeSincePrimaryAttack < 0.1f)
{
targetVectorRot -= new Vector3(0, 0, roll);
Expand Down
4 changes: 4 additions & 0 deletions code/swb_base/ui/SniperScope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ public override void Tick()
// Show when zooming
Style.Opacity = !weapon.IsScoped ? 0 : 1;

// Check if ADS & firing
if (weapon.IsZooming && weapon.TimeSincePrimaryAttack < 0.1f)
return;

// Movement impact
var velocityJump = player.Velocity.z * 0.02f;
var velocityMove = (Math.Abs(player.Velocity.y) + Math.Abs(player.Velocity.x)) * 0.005f;
Expand Down

0 comments on commit 74dfb0d

Please sign in to comment.