Skip to content

Commit

Permalink
Merge pull request #232 from Centurion-Creative-Connect/feature/make-…
Browse files Browse the repository at this point in the history
…use-of-scroll-for-desktop-gun-direction

Make use of Mouse Scroll for gun pitch handling
  • Loading branch information
DerpyNewbie authored Aug 24, 2024
2 parents fb0657a + c9a278b commit 8a191b5
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions Packages/org.centurioncc.system/Runtime/Gun/Gun.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1126,27 +1126,10 @@ protected void Internal_HandleDesktopInputs()
FireMode = GunUtility.CycleFireMode(FireMode, AvailableFireModes);
}

if (Input.GetKeyDown(KeyCode.LeftShift))
var scrollDelta = Input.GetAxisRaw("Mouse ScrollWheel") * 80F;
if (!Mathf.Approximately(scrollDelta, 0) && !Input.GetKey(KeyCode.LeftShift))
{
CurrentMainHandlePitchOffset = 90;
RequestSerialization();
}

if (Input.GetKeyUp(KeyCode.LeftShift))
{
CurrentMainHandlePitchOffset = 0;
RequestSerialization();
}

if (Input.GetKeyDown(KeyCode.PageUp))
{
CurrentMainHandlePitchOffset -= 5;
RequestSerialization();
}

if (Input.GetKeyDown(KeyCode.PageDown))
{
CurrentMainHandlePitchOffset += 5;
CurrentMainHandlePitchOffset += scrollDelta;
RequestSerialization();
}
}
Expand Down

0 comments on commit 8a191b5

Please sign in to comment.