XBOX Input example using OuyaInputManager and OuyaControllerMapping

pekpek Posts: 3Member
Hey guys,

The new Unity package contains a OuyaInputManager class and a OuyaControllerMapping class. Can somebody give me an example of how to detect if player 1 has pressed the Start button on the XBOX controller using both those classes?

Thank you in advance,
Pek

Comments

  • AyrikAyrik Posts: 429Member
    Uncheck Use Legacy Input and just use the normal Input manager using this as a guide. If you want to use the Legacy input (I don't suggest it at all), then you'll have to do a bunch more work adding the keycodes and message events to the giant switch statements in OuyaInputManager.
    Saga Heroes - Adventure RPG
    image image
  • pekpek Posts: 3Member
    Hey Ayrik,

    Thanks for the reply. I'm all for using Unity's standard Input system, are you suggesting I setup all the Axis for every button and every player? Like Player1LeftHorizontal, Player2LeftHorizontal, Player1StartButton, Player2StartButton, etc, etc or is there a better way of setting this up?

    I'm making a 4-player local multiplayer. I've seen the videos of Super Dungeon Bros (awesome game BTW) and I'm trying to detect when a controller presses start to spawn his avatar in the game, pretty much what your game-play trailer shows at around 0:14.

    Can you provide a little more information on how to set this up?

    Thank you very much!
  • AyrikAyrik Posts: 429Member
    edited April 2013
    Yes, that's what you have to do. The ODK Unity plugin has an InputManager.asset that has all those axes set up for you. "Joy1 Axis 1" is 1st player's Horizontal and "Joy1 Axis 2" is Vertical. So you do something like float horizontal = Input.GetAxis("Joy" + controllerIndex + " Axis 1");
    Post edited by Ayrik on
    Saga Heroes - Adventure RPG
    image image
  • pekpek Posts: 3Member
    Cool, I'll try that then. Thanks!
  • tgraupmanntgraupmann Posts: 2,869Administrator, Team OUYA
    Take a look at OuyaExampleCommon for an easy way to do platform independent input.

    I wouldn't route anything to the start button since the OUYA controller doesn't have a start button.

    That is unless you have an options menu where you can select your own buttons...
    ~Tim Graupmann
    OUYA Inc | Android Developer
    Skype: tgraupmann_prey

    http://github.com/ouya/docs
    http://github.com/ouya/ouya-sdk-examples

    Check out the latest docs for your game engine: [setup] [adobe air] [android] [clickteam fusion] [construct 2] [corona] [libGDX] [game maker] [html5] [marmalade] [monogame] [unity] [unreal]

    Use caution when setting [persistent wireless mode].
Sign In or Register to comment.