Gamepad demo examples?
by AzraelK · in Torque Game Builder · 10/18/2006 (2:26 pm) · 8 replies
Is it possible to use the Gamepad with the TGB is there any Demo/example for this available?
#2
I would really like to know how to use the D-Pad/Joystick.
Because all the results I'm getting with it right now are craps :/
10/21/2006 (11:13 am)
The D-Pad is recognized just like a joystick, but I did'nt get it to work (on a ps2-pad adaptator).I would really like to know how to use the D-Pad/Joystick.
Because all the results I'm getting with it right now are craps :/
#3
update: Oh sorry It was a problem with my command sintaxis, it does work ! thanks!
10/23/2006 (10:02 am)
Thanks Paul it does say thay device joystick0 has been created, but it wont do anyting when I press a button Is supposed to do a command when button1 is pressed.update: Oh sorry It was a problem with my command sintaxis, it does work ! thanks!
#4
10/23/2006 (12:13 pm)
Why do I get -1.5 as the center of the Xaxis? how can I calibrate that?
#5
10/23/2006 (2:11 pm)
That's a matter of calibrating the joypad in Windows. Go find the "Game Controllers" option in the Windows Control Panel or something. However it will likely always have _some_ miniscule input. Tom Spillman wrote a nice little function to filter the joystick axis data in the adventure pack. I dunno if I can post the actual function, but it's pretty easy to replicate.
#6
10/23/2006 (4:10 pm)
Joystick is one of the most basic features of game engines, I don't think it's a bad thing to tell us how to use it, you know.
#7
I think you could also set it up as "xpov" and "ypov". -not sure didn't test it.
10/24/2006 (9:43 am)
The dpad is "dpov", "upov", "rpov", "lpov".I think you could also set it up as "xpov" and "ypov". -not sure didn't test it.
#8
First on game.cs startgame use this:
then on the bindings in player.cs add :
And finally the code itself
That 1.5 something value is what I get when the joystiq is at rest. Im not sure if you get the same value.
p.s. Any ideas on how to send vibration feedback?
10/24/2006 (12:19 pm)
Well on the meanwhile heres the code I used on the miniplatformer to get the character moving with the joystiq ;)First on game.cs startgame use this:
$enableDirectInput = true; activateDirectInput(); enableJoystick();
then on the bindings in player.cs add :
moveMap.bind(joystick0, "xaxis", xaxis);
moveMap.bindCmd(joystick0, "button0", "playerJump();", "");
moveMap.bindCmd(joystick0, "button2", "playerAttack();", "");And finally the code itself
function xaxis(%val){
if (%val==-1.5259e-005){
%val=0;
playerLeftStop();
playerRightStop();
$pGuy.setLinearVelocityX(0);
$xval=%val;
return;
}
$xval=%val;
if (%val>0.3){
playerLeftStop();
playerRight();
}
if (%val<-0.3) {
playerRightStop();
playerLeft();
}
}That 1.5 something value is what I get when the joystiq is at rest. Im not sure if you get the same value.
p.s. Any ideas on how to send vibration feedback?
Torque Owner Paul /*Wedge*/ DElia
Then you can set keybinds for it like:
You can say "joystick1" and that will reference the second joypad plugged into the computer. You use "x/yaxis" for the left anlogue stick and "rx/ryaxis" for the right analogue stick. "zaxis" and "rzaxis" are the triggers on a 360 controller. Any of the other buttons will be a button