Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Help! Joystick trouble.

Discussion in 'Editor & General Support' started by madcalf, Mar 31, 2006.

  1. madcalf

    madcalf

    Joined:
    Jan 12, 2006
    Posts:
    56
    Hello o knowledgable forum folk!

    We're using a Happ USB Game Control Interface (UCGI), which is HID compliant with their Super Joystick (4 position digital joystick that uses 4 microswitches), and 3 plain push buttons. We're working with Unity 1.2.2b1 on G5 PPC Macs, btw.

    I exepcted that we could just wire everything up, plug it in, and query the input via Input.GetAxis(...) and happiness would reign. But we aren't getting any input that way. The only way I can get anything is to map the joystick axes to keystrokes with USBOverdrive. The problem here is that it only works in the Unity authoring environment and not in the built application (PPC Standalone).

    I know there were few posts about USB Overdrive not working, but I could'nt tell the definitive circumstances of when it doesn't work. And it does work in authoring, so i'm truly perplexed. But really, i'm wondering what I need to do to get the straight input without needing to map to keystrokes.

    Do we need a specific type of joystick (analog vs digital)? Any reccommendations? What kinds of joysticks have folks had success with? This is going in a museum with lots of kids so we need it to be able to take a pounding - hence the Happ joysticks.

    The following are links to the Happ bits we have, in case anyone out there knows about these things. Any help at all would be most appreciated! Thanx! -d

    Fighting USB Game Control Interface (95-0800-30K)
    http://www.happcontrols.com/joysticks/950800xx.htm

    Super Joystick (50-6084-00):
    http://www.happcontrols.com/joysticks/super_joy.htm
     
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    If your joystick has digital input most likely it will be recognized as a button not as an axis.

    In the input manager you can setup axes from digital buttons though.

    1. Select Edit -> Project Settings -> Input
    2. Open Element 0 (name "Horizontal")
    3. Change positive button to "joystick button 0"

    If it you didn't find the right button in the joystick just try a different index:
    "joystick button 1", "joystick button 2" etc until you find the right button.
     
  3. madcalf

    madcalf

    Joined:
    Jan 12, 2006
    Posts:
    56
    Sadly, this does not seem to be working. I'm only getting input 1 axis.

    The player will rotate one way while joystick was the left position, and the other way in the right position. But when releasing the joystick to the center position (no switches are contacting) it rotates continuously instead of stopping, as if I were holding the joystick to the right.

    And it doesn't seem to matter what button numbers I test for in the 'positive button' field. I tried 0 thru 7 and all produced the exact same result. Then I tried deleting all but one axis and not having any value in the 'positive button' field. Still got the exact same result.

    So I can't really tell what it's reading, here. In the IDE, it doesn't even respond to the joystick. But in the bulit application it only goes back and forth on the one axis (doesn't matter which). Doesn't seem to acknowledge any other numbers defined in any other axes. Just seems to apply whatever numbers it's getting to the first axis defined.

    So, I'm guessing the problem is the joystick.

    Can you tell me what kinds of joysticks do work? Happ makes an analog version of it's UCGI controller and a bunch of analog joysticks, and we're considering this. But any info on what the baseline joystick is for Unity would be helpful so we know what to look for or what questions to ask the Happ folk. Sorry, i'm not so knowledgable about these things.

    thanx!
    d
     
  4. Sync1B

    Sync1B

    Joined:
    Sep 13, 2005
    Posts:
    561
    Well I dont think it's exactly what your looking for but I have a Saitek Cyborg Evo, and it works fantastically. I have had no problems using it with unity. Even on projects where other people say there joystick doesn't work it will work with mine. They also have a force feedback and wireless edition. It's nice check it out.

    Bill
     
  5. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    We have tested with a lot of logitech joysticks and game pads all of which worked perfectly fine.

    I contacted happcontrols to send us one of their joysticks for testing. Lets see if they do it.

    If you want to you can also send us the joystick you want to use and we can make sure it works correctly.
     
  6. guategeek_legacy

    guategeek_legacy

    Joined:
    Jun 22, 2005
    Posts:
    659
    Can you try get more Saitek ones working. I have a Cyborg3D Gold and Neil has an older Cyborg model and they don't work corectly. Jeff
     
  7. NCarter

    NCarter

    Joined:
    Sep 3, 2005
    Posts:
    686
    At the risk of hijacking the thread (sorry madcow!)....

    Unfortunately, I've had plenty of problems with joystick input, and much of it seems to stem from the fact that many joysticks have really stupid hardware configurations.

    For example, my Saitek Cyborg 3D stick has a non-central idle position. Apple's HID Explorer app shows that all its axes go from about 20 to 170, with the idle position being about 95, instead of evenly occupying the entire 0-255 range as you'd expect. In Unity, this joystick tends to cause the controls to lean to the side constantly, unless you hold the stick offcentre to compensate. It's essentially unusable in Unity as a result. On the other hand, thinking about it, maybe I can compensate for this in my own scripts....

    The HID Explorer has some code to automatically recentralise the axes by monitoring the minimum and maximum values. After moving the joystick around a bit, the axes settle down and become properly normalised. Perhaps Unity could do something similar.

    The other problem is that I can't seem to get the third and fourth joystick axes (as set in the Input settings) to return anything at all for either of my joysticks. Is there some trick to making them work?
     
  8. forestjohnson

    forestjohnson

    Joined:
    Oct 1, 2005
    Posts:
    1,370
    Maybe madcow has gravity on zero?.... Just a thought.

    The "Gravity" number in a input thingy is how fast it should return to zero when the button is let go.