Game Development Community

PS2 type controller

by Jermaine Morgan · in Torque Game Engine · 01/31/2007 (7:08 pm) · 6 replies

How do i map a ps2 type of controller in torque?

what would i replace moveMap.bind( keyboard, a, moveleft );
with?


i have a logitech controller

#1
01/31/2007 (7:42 pm)
More info i forgot to provide about the controller
its a logitech rumblepad controller,
has dual analog control.
and button have number on them.
#2
02/01/2007 (8:00 am)
Bump i have search but everything i have tried does not work, can someone who has experience with help?
#3
02/01/2007 (8:09 am)
Hey Jermaine. Here's some info that'll help you on your way:

TDN Topic for Input Activation

When your game is running, you'll want to make sure DirectInput is enabled and activated.

Next, make sure your gamepad is plugged in, then enable and activate it.

Poll the joystick to make sure it acknowledged by Torque.

To find out what buttons you'd map, have a look in engine\sim\actionMap.cc.

Sample of joystick/mouse map from actionMap.cc::
//-------------------------------------- BUTTON EVENTS
   // Joystick/Mouse buttons
   { "button0",       SI_BUTTON, KEY_BUTTON0    },
   { "button1",       SI_BUTTON, KEY_BUTTON1    },
   { "button2",       SI_BUTTON, KEY_BUTTON2    },
   { "button3",       SI_BUTTON, KEY_BUTTON3    },
   { "button4",       SI_BUTTON, KEY_BUTTON4    },

  //-------------------------------------- MOVE EVENTS
   // Mouse/Joystick axes:
   { "xaxis",         SI_MOVE,   SI_XAXIS       },
   { "yaxis",         SI_MOVE,   SI_YAXIS       },
   { "zaxis",         SI_MOVE,   SI_ZAXIS       },
   { "rxaxis",        SI_MOVE,   SI_RXAXIS      },
   { "ryaxis",        SI_MOVE,   SI_RYAXIS      },
   { "rzaxis",        SI_MOVE,   SI_RZAXIS      },
   { "slider",        SI_MOVE,   SI_SLIDER      },

//-------------------------------------- POV EVENTS
   // Joystick POV:
   { "xpov",          SI_POV,    SI_XPOV        },
   { "ypov",          SI_POV,    SI_YPOV        },
   { "upov",          SI_POV,    SI_UPOV        },
   { "dpov",          SI_POV,    SI_DPOV        },
   { "lpov",          SI_POV,    SI_LPOV        },

Once you know your gamepad is working, and you know your event names, you would do something like this:

moveMap.bind(joystick0, "button0", fire);
#5
02/05/2007 (10:19 am)
This is weird. I get e-mails that tell me about a reply to this post from Jermaine, but they don't show up on the thread. Regardless, the last e-mail notification I received said that you were having trouble with the analog sticks. This is a common problem when setting up input, which has a solution:
Torque Analog Input
#6
02/05/2007 (10:21 am)
Yeah thanks, i had posted but once i figured out the problem i deleted the post.

sorry, but thanks for the help