Using the Xbox 360 controller analog sticks
by USC - IMD student 4 · in Torque Game Builder · 03/09/2008 (2:51 pm) · 2 replies
Hello everyone, I'm trying to implement an Xbox 360 controller into TGB through a behavior I will assign to the player sprite.
My method of binding the buttons (A, B, X, Y) WORKS, and is as follows:
function controllerBehavior::onBehaviorAdd(%this)
{
moveMap.bindObj(joystick0, "button0", "check", %this);
}
etc. for B, X, and Y.
The function does NOT work with the analog control sticks. Nothing happens when they're bound with a bindObj.
So, anyone know how to bind the analog sticks (and thus call functions) within CURRENT versions of torque that utilize behaviors?
My method of binding the buttons (A, B, X, Y) WORKS, and is as follows:
function controllerBehavior::onBehaviorAdd(%this)
{
moveMap.bindObj(joystick0, "button0", "check", %this);
}
etc. for B, X, and Y.
The function does NOT work with the analog control sticks. Nothing happens when they're bound with a bindObj.
So, anyone know how to bind the analog sticks (and thus call functions) within CURRENT versions of torque that utilize behaviors?
About the author
#2
I didn't actually need to have the functions be part of a behavior, it was just natural for me to try to code them that way because everything else I've written for the game has been contained in behaviors.
Thanks again!
03/17/2008 (12:02 pm)
Thanks for the help, Tom. What I ended up doing was binding all the buttons and analog sticks within game.cs, using the code found at http://tdn.garagegames.com/wiki/Script/Input_Keys_and_Maps as a guide. I didn't actually need to have the functions be part of a behavior, it was just natural for me to try to code them that way because everything else I've written for the game has been contained in behaviors.
Thanks again!
Associate Tom Eastman (Eastbeast314)
You could set it up in a behavior anyway using its namespace.
here
here
and here