Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Can mouse input continue once it reaches edge of screen?

Discussion in 'Input System' started by Shin_Toasty, Oct 16, 2023.

  1. Shin_Toasty

    Shin_Toasty

    Joined:
    Jun 15, 2017
    Posts:
    48
    Hello, as an option in the game I'm working on I'd like to enable retro arcade-style spinner/trackball input.

    You don't need to know what these devices are really; but basically in the old input system this single line would have done what I need:

    Code (CSharp):
    1. gameSpinner.transform.Rotate(0.0f, 0.0f, Input.GetAxis ("Horizontal") * rotateSpeed);
    I don't want to move the mouse pointer I just want the arcade spinner to be able to send continuous left / right input to the game.

    I have tried reading a float from the PositionX/Mouse Path and it works - but the mouse pointer moves across the screen - and once it reaches the edge, input stops. Hiding the mouse and using WarpCursorPosition to send it back to the other side of the screen would be daft.

    Retro spinners and trackballs used by MAME players e.g.
    https://www.arcadeworlduk.com/products/spinner-with-silver-knob-usb-connection.html
    work by sending mouse inputs to your PC.
     
    Last edited: Oct 16, 2023
  2. Shin_Toasty

    Shin_Toasty

    Joined:
    Jun 15, 2017
    Posts:
    48
    Heh, who needs new input system delegates when you can just add this to Update:

    Code (CSharp):
    1. mouseDelta = Mouse.current.delta.ReadValue();
    2. gameSpinner..transform.Rotate(0, 0, mouseDelta.x);
    Tagged with derp. You can't know everything.