Issue with 360 Wired Controller.
by Will Smith · in Torque 3D Professional · 08/25/2009 (3:58 am) · 15 replies
Hey all,
I'm having a weird issue with my 360 Wired USB Controller in T3D.
When I load into any of the example games included with the T3D Beta (FPS Genre Kit, Full, or PhysX) the players gun just keeps firing nonstop until I hit the shoot button a few times then it stops and acts normally. Also whenever I adjust the Pitch or Yaw with the Gamepad stick it seems to move only a little and not rotate properly. It's extremely rigid and broken.
I've used the gamepad before in TGEA and Torque X 3D and never had this issue. The gamepad works fine in other PC games.
Anyone else run into this issue?
I'm using the default gamepad binds setup in the full template default.bind.cs
I appreciate any help with this matter.
I'm having a weird issue with my 360 Wired USB Controller in T3D.
When I load into any of the example games included with the T3D Beta (FPS Genre Kit, Full, or PhysX) the players gun just keeps firing nonstop until I hit the shoot button a few times then it stops and acts normally. Also whenever I adjust the Pitch or Yaw with the Gamepad stick it seems to move only a little and not rotate properly. It's extremely rigid and broken.
I've used the gamepad before in TGEA and Torque X 3D and never had this issue. The gamepad works fine in other PC games.
Anyone else run into this issue?
I'm using the default gamepad binds setup in the full template default.bind.cs
I appreciate any help with this matter.
#2
08/25/2009 (2:32 pm)
You need to setup the binds for the controller, but if you create a new project using the Full Template in T3D, It will have the default binds setup for you.
#3
08/25/2009 (4:26 pm)
Thanks a bunch. I will have to check this out later on today. I will get back to you with my results. Have a good one!
#4
It seems very odd that no one else has encountered this problem.
08/26/2009 (3:50 pm)
Ok well I tested on another computer and still seems to be an issue.It seems very odd that no one else has encountered this problem.
#5
To be honest I didn't spend much time looking at it, it just happened to be plugged in. So I believe I know what you're talking about.
08/26/2009 (5:50 pm)
I've experienced the issue with the rotation being jerky and not smooth. Using the wireless USB hub to wireless 360 controller.To be honest I didn't spend much time looking at it, it just happened to be plugged in. So I believe I know what you're talking about.
#6
Quoted from Jason Parker
08/26/2009 (6:57 pm)
Several other people have mentioned issues with using an Xbox controller...Quoted from Jason Parker
Quote:The method for firing in the default scripts is to assign the Xbox 360 triggers to the mouse fire functions. Those functions do not handle the fact that the triggers on the 360 gamepad output values throughout the range of the pull AND release. And for some reason, it defaults to outputting a value from the trigger too in most cases.I don't have any solution to offer, nor do I use such a controller, but I did want to acknowledge that other people have experienced this.
Their new yaw and pitch scripting also doesn't work properly with the right analog stick for looking around. I have alternate gamepad scripting for my projects that I find work pretty acceptably with the exception that my triggers only fire on a full pull of the trigger, wasting the range of the thing...
#7
I'm pretty sure this is only a T3D issue because I've never seen this before.
08/26/2009 (7:13 pm)
Hrmm, I'm going to try the controller in TGEA, and Torque X 3D again.I'm pretty sure this is only a T3D issue because I've never seen this before.
#8
Without using Xinput, the triggers will always only register as buttons, not as continues "joysticks". If they are recognized correctly, they tend to have joystick nr 4 and 5 (right stick for some reason ends on 3 and 6)
and the default binds for T3D has slightly changed since TGEA, so you might want to compare them with winmerge or some other merge tool
08/26/2009 (9:09 pm)
TorqueX is an XNA based technology and will not have any issues as it is targeted at this and this controller, so having it workign there is no indication for anything :)Without using Xinput, the triggers will always only register as buttons, not as continues "joysticks". If they are recognized correctly, they tend to have joystick nr 4 and 5 (right stick for some reason ends on 3 and 6)
and the default binds for T3D has slightly changed since TGEA, so you might want to compare them with winmerge or some other merge tool
#9
T3D default binds for the 360 gamepad changed between one of the betas. Seemed to be after the fix I posted for the make/break value in the Xinput code.
My binds aren't perfect, but work. If you're interested, I could post them. I just don't know what to do about the trigger code to make it useful within the full trigger range, rather than just a full pull. My math for the right analog stick speeds may be a bit slow for some, a bit fast for others. I never did hook it up to the options dialog to allow for sensitivity customizing like I wanted to. And the speed change when zoomed is done with a static value which, again, could be done better and made properly dynamic.
If you still want it, just ask.
08/26/2009 (9:20 pm)
The default binds in TGEA weren't perfect either, but they didn't seem to have as many problems as the T3D ones.T3D default binds for the 360 gamepad changed between one of the betas. Seemed to be after the fix I posted for the make/break value in the Xinput code.
My binds aren't perfect, but work. If you're interested, I could post them. I just don't know what to do about the trigger code to make it useful within the full trigger range, rather than just a full pull. My math for the right analog stick speeds may be a bit slow for some, a bit fast for others. I never did hook it up to the options dialog to allow for sensitivity customizing like I wanted to. And the speed change when zoomed is done with a static value which, again, could be done better and made properly dynamic.
If you still want it, just ask.
#10
@Jason if you don't mind sharing your changes, that would be great and I would really appreciate it.
08/26/2009 (10:23 pm)
Hey guys, thanks for the responses.@Jason if you don't mind sharing your changes, that would be great and I would really appreciate it.
#11
The pitch and yaw functions really could be written better. The look multiplier would ideally be variable and configured through the Options menu. Since I modified GG's functions from earlier betas, there may be left over lines in the functions that aren't used and do nothing. I by no means consider this clean or release quality.
EDIT:
Okay... too long for a post, even by itself. Let me post just the gamepad section. You'll need to remove the conflicting lines from elsewhere in your default.bind.cs on your own.
08/26/2009 (10:42 pm)
I rearranged the default.bind.cs a bit with my changes. Mainly, I moved all gamepad functionality to it's own section.The pitch and yaw functions really could be written better. The look multiplier would ideally be variable and configured through the Options menu. Since I modified GG's functions from earlier betas, there may be left over lines in the functions that aren't used and do nothing. I by no means consider this clean or release quality.
EDIT:
Okay... too long for a post, even by itself. Let me post just the gamepad section. You'll need to remove the conflicting lines from elsewhere in your default.bind.cs on your own.
//------------------------------------------------------------------------------
// Gamepad Movement
//------------------------------------------------------------------------------
function gamePadMoveX( %val )
{
if(%val > 0)
{
$mvRightAction = %val * $movementSpeed;
$mvLeftAction = 0;
}
else
{
$mvRightAction = 0;
$mvLeftAction = -%val * $movementSpeed;
}
//$mvXAxis_L = %val;
}
function gamePadMoveY( %val )
{
if(%val > 0)
{
$mvForwardAction = %val * $movementSpeed;
$mvBackwardAction = 0;
}
else
{
$mvForwardAction = 0;
$mvBackwardAction = -%val * $movementSpeed;
}
//$mvYAxis_L = %val;
}
//This is the static look multiplier. Preferrably, this would be variable...
$lookMultiplier = 0.2;
function gamepadYaw(%val)
{
if( $pref::invertXCamera )
%val *= -1.0;
// if we get a non zero val, the user must have moved the stick, so switch
// out of keyboard/mouse mode
if (%val != 0.0)
$mvDeviceIsKeyboardMouse = false;
// stick events come in even when the user isn't using the gamepad, so make
// sure we don't slam the move if we don't think the user is using the gamepad
if (!$mvDeviceIsKeyboardMouse)
{
%scale = (ServerConnection.gameState $= "wait") ? -0.2 : 3.14;
$mvYawRightSpeed = $lookMultiplier * (mPow(%val*1.5, 2)/1.5) * (%val * -1.0);
}
}
function gamepadPitch(%val)
{
if( $pref::invertYCamera )
%val *= -1.0;
// if we get a non zero val, the user must have moved the stick, so switch
// out of keyboard/mouse mode
if (%val != 0.0)
$mvDeviceIsKeyboardMouse = false;
// stick events come in even when the user isn't using the gamepad, so make
// sure we don't slam the move if we don't think the user is using the gamepad
if (!$mvDeviceIsKeyboardMouse)
{
%scale = (ServerConnection.gameState $= "wait") ? -0.2 : 3.14;
$mvPitchUpSpeed = $lookMultiplier * (mPow(%val*1.5, 2)/1.5) * (%val * -1.0);
}
}
moveMap.bind(gamepad, thumblx, "D", "-0.23 0.23", gamePadMoveX);
moveMap.bind(gamepad, thumbly, "D", "-0.23 0.23", gamePadMoveY);
moveMap.bind(gamepad, thumbrx, "D", "-0.23 0.23", gamepadYaw);
moveMap.bind(gamepad, thumbry, "D", "-0.23 0.23", gamepadPitch);
moveMap.bind(gamepad, btn_a, jump);
//------------------------------------------------------------------------------
// Gamepad Triggers
//------------------------------------------------------------------------------
function gamepadFire(%val)
{
if(%val == 1.0)
{
$mvTriggerCount0++;
$trigPulled++;
}
else
{
$mvTriggerCount0 = 0;
$trigPulled = 0;
}
}
function gamepadAltTrigger(%val)
{
if(%val == 1.0)
{
$mvTriggerCount1++;
}
else
{
$mvTriggerCount1 = 0;
}
}
moveMap.bind(gamepad, "triggerr", gamepadFire);
moveMap.bind(gamepad, "triggerl", gamepadAltTrigger);
//------------------------------------------------------------------------------
// Gamepad Buttons
//------------------------------------------------------------------------------
moveMap.bindCmd(gamepad, btn_start, "escapeFromGame();", "");
moveMap.bind(gamepad, btn_back, toggleFirstPerson);
moveMap.bindCmd(gamepad, dpadl, "toggleLightColorViz();", "");
moveMap.bindCmd(gamepad, dpadu, "toggleDepthViz();", "");
moveMap.bindCmd(gamepad, dpadd, "toggleNormalsViz();", "");
moveMap.bindCmd(gamepad, dpadr, "metrics(\"fps gfx shadow\");", "");
//moveMap.bindCmd(gamepad, btn_lt, );
moveMap.bind(gamepad, btn_rt, toggleZoom);
//moveMap.bind(gamepad, "btn_l", );
//moveMap.bind(gamepad, "btn_r", );
//moveMap.bind(gamepad, "btn_b", );
//moveMap.bind(gamepad, "btn_x", );
//moveMap.bind(gamepad, "btn_y", );
#12
Here's mine:
08/26/2009 (10:45 pm)
You'll also need to modify your zoom function. Default speeds are too fast when zoomed and thus make it useless.Here's mine:
function toggleZoom( %val )
{
if ( %val )
{
$ZoomOn = true;
//Modify the look multiplier if zoomed. Default is too fast.
$lookMultiplier = 0.005;
setFov( $Pref::player::CurrentFOV );
}
else
{
$ZoomOn = false;
//Reset look multiplier. This needs to be changed to a
//configurable variable.
$lookMultiplier = 0.2;
setFov( $Pref::player::DefaultFOV );
}
}
#13
08/27/2009 (12:14 am)
Thanks Jason, after adding your changes it behaves exactly as it used to prior to T3D :)
#14
08/27/2009 (4:17 am)
This works for the wireless 360 as well. :)
#15
AFAIK, they behave identical whether wired or wireless.
08/27/2009 (9:20 am)
Yeah, I was using the wireless controller when I made the modifications.AFAIK, they behave identical whether wired or wireless.
Torque 3D Owner dublnegative
Thanks in advance.