Commercial steering wheel device
by Francisco Ramos · in General Discussion · 04/10/2008 (2:04 am) · 3 replies
Can anybody tell me if TGE does support a commercial steering wheel device as an input?
Any advice will be very wellcome.
Thanks in advance.
Any advice will be very wellcome.
Thanks in advance.
#2
The hard part to my mind is:
1) designing the control scripts that let you use mouse, joystick(s), and keyboard together (or switching back and forth),
2) developing GUI to allow the user to select and bind all these controls.
Here is a little GUI to help debug multiple joystick problems during development. It is perhaps quicker than digging through the code for stick capabilities structures. You can also add to it to test various binding strategies before you hook them into the Torque systems. (This HUD is off in its own self contained little world.) You will probably want to replace the hudfill backdrop texture with something else. (I use one called "white")
You can call it from the main menu: JoyStickHUD2.testInit();
Then you can wiggle the axes and see which one moves, so you can then bind them.
It is useful for surveying the axes and hard coding them before you have a comprehensive axis-binding system in place to do this. I use several computers to develop and the joystick configs are different (and often change). This lets me figure out what joysticks and axes need to be set up for the particular dev computer in use.
Note that some sticks use "zaxis" and another might use "slider" as axis names. I didn't run into one of these very annoying "slider" joysticks until after I had been using this HUD ffor awhile. The HUD should probably be upgraded to display both so you can see what your stick provides.
04/10/2008 (11:13 am)
Yes, and I feel that is the easy part. ;)The hard part to my mind is:
1) designing the control scripts that let you use mouse, joystick(s), and keyboard together (or switching back and forth),
2) developing GUI to allow the user to select and bind all these controls.
Here is a little GUI to help debug multiple joystick problems during development. It is perhaps quicker than digging through the code for stick capabilities structures. You can also add to it to test various binding strategies before you hook them into the Torque systems. (This HUD is off in its own self contained little world.) You will probably want to replace the hudfill backdrop texture with something else. (I use one called "white")
You can call it from the main menu: JoyStickHUD2.testInit();
Then you can wiggle the axes and see which one moves, so you can then bind them.
It is useful for surveying the axes and hard coding them before you have a comprehensive axis-binding system in place to do this. I use several computers to develop and the joystick configs are different (and often change). This lets me figure out what joysticks and axes need to be set up for the particular dev computer in use.
Note that some sticks use "zaxis" and another might use "slider" as axis names. I didn't run into one of these very annoying "slider" joysticks until after I had been using this HUD ffor awhile. The HUD should probably be upgraded to display both so you can see what your stick provides.
// 2007 Matthew V. Jessick
// This is a two joystick axis monitor fixed for Joystick 0, Joystick1
// Use to debug two stick problems
// Call this in main menu to enable the sticks and turn on this GUI: JoyStickHUD2.testInit();
//--- OBJECT WRITE BEGIN ---
new GuiControl(JoyStickHUD2) {
profile = "GuiModelessDialogProfile";
horizSizing = "width";
vertSizing = "height";
position = "0 0";
Extent = "1024 768";
MinExtent = "8 8";
visible = "1";
helpTag = "0";
new GuiControl(JoyStickContainer2) {
profile = "GuiDefaultProfile";
horizSizing = "relative";
vertSizing = "relative";
position = "256 192";
Extent = "512 384";
MinExtent = "8 8";
visible = "1";
helpTag = "0";
new GuiBitmapCtrl() {
profile = "GuiDefaultProfile";
horizSizing = "relative";
vertSizing = "relative";
position = "0 0";
Extent = "512 384";
minExtent = "8 8";
visible = "1";
helpTag = "0";
// bitmap = "./white.png";
bitmap = "./hudfill.png";
wrap = "0";
};
new GuiControl(ProgressContainer) {
profile = "GuiDefaultProfile";
horizSizing = "relative";
vertSizing = "relative";
position = "100 50";
Extent = "200 250";
MinExtent = "8 8";
visible = "1";
helpTag = "0";
new GuiProgressCtrl(xProgress2) {
profile = "GuiProgressProfile";
horizSizing = "relative";
vertSizing = "relative";
position = "0 0";
extent = "200 25";
minExtent = "8 8";
visible = "1";
helpTag = "0";
new GuiTextCtrl(xProgress2Txt) {
profile = "GuiProgressTextProfile";
horizSizing = "relative";
vertSizing = "relative";
position = "0 2";
extent = "200 20";
minExtent = "8 8";
visible = "1";
text = "X";
maxLength = "255";
helpTag = "0";
};
};
new GuiProgressCtrl(yProgress2:xProgress2) { position = "0 25"; new GuiTextCtrl(yProgressTxt:xProgressTxt) { text = "Y"; }; };
new GuiProgressCtrl(zProgress2:xProgress2) { position = "0 50"; new GuiTextCtrl(zProgressTxt:xProgressTxt) { text = "Z"; }; };
new GuiProgressCtrl(rzProgress2:xProgress2){ position = "0 75"; new GuiTextCtrl(rzProgressTxt:xProgressTxt) { text = "RZ"; }; };
new GuiProgressCtrl(x1Progress2:xProgress2) { position = "0 125"; new GuiTextCtrl(x1ProgressTxt:xProgressTxt) { text = "X"; }; };
new GuiProgressCtrl(y1Progress2:xProgress2) { position = "0 150"; new GuiTextCtrl(y1ProgressTxt:xProgressTxt) { text = "Y"; }; };
new GuiProgressCtrl(z1Progress2:xProgress2) { position = "0 175"; new GuiTextCtrl(z1ProgressTxt:xProgressTxt) { text = "Z"; }; };
new GuiProgressCtrl(rz1Progress2:xProgress2){ position = "0 200"; new GuiTextCtrl(rz1ProgressTxt:xProgressTxt) { text = "RZ"; }; };
};
};
};
//--- OBJECT WRITE END ---
#3
04/10/2008 (11:13 am)
//----------------------------------------
JoyStickHUD2.noCursor = "1";
// ================================
function JoyStickHUD2::setJSValues()
{
// convert -1..1 to 0..1 for progress bar
xProgress2.setValue(JoyStickHUD2::changeRange($js2hXaxisLast,-1.0,1.0,0.0,1.0));
yProgress2.setValue(JoyStickHUD2::changeRange($js2hYaxisLast,-1.0,1.0,0.0,1.0));
zProgress2.setValue(JoyStickHUD2::changeRange($js2hZaxisLast,-1.0,1.0,0.0,1.0));
rzProgress2.setValue(JoyStickHUD2::changeRange($js2hRZaxisLast,-1.0,1.0,0.0,1.0));
x1Progress2.setValue(JoyStickHUD2::changeRange($js2hXaxis1Last,-1.0,1.0,0.0,1.0));
y1Progress2.setValue(JoyStickHUD2::changeRange($js2hYaxis1Last,-1.0,1.0,0.0,1.0));
z1Progress2.setValue(JoyStickHUD2::changeRange($js2hZaxis1Last,-1.0,1.0,0.0,1.0));
rz1Progress2.setValue(JoyStickHUD2::changeRange($js2hRZaxis1Last,-1.0,1.0,0.0,1.0));
}
function JoyStickHUD2::jshClear()
{
$js2hXaxisLast = 0.0;
$js2hYaxisLast = 0.0;
$js2hZaxisLast = 0.0;
$js2hRZaxisLast = 0.0;
$js2hXaxis1Last = 0.0;
$js2hYaxis1Last = 0.0;
$js2hZaxis1Last = 0.0;
$js2hRZaxis1Last = 0.0;
//TEMP test
xProgress2.setValue( 0.1 );
yProgress2.setValue( 0.2 );
zProgress2.setValue( 0.3 );
rzProgress2.setValue( 0.4 );
x1Progress2.setValue( 0.15 );
y1Progress2.setValue( 0.25 );
z1Progress2.setValue( 0.35 );
rz1Progress2.setValue( 0.45 );
echo("JoyStickHUD2::jshClear");
}
function JoyStickHUD2::onWake(%this)
{
JoyStickHUD2::jshClear();
JoyStickHUD2Map.push();
echo("JoyStickHUD2Map.push()");
}
function JoyStickHUD2::onSleep(%this)
{
JoyStickHUD2::jshClear();
JoyStickHUD2Map.pop();
echo("JoyStickHUD2Map.pop()");
}
function JoyStickHUD2::toggle(%this)
{
if(%this.isAwake()) {
Canvas.popDialog(%this);
} else {
Canvas.pushDialog(%this);
}
}
function JoyStickHUD2::switchOn(%this)
{
if(!%this.isAwake()) {
Canvas.pushDialog(%this);
}
}
function JoyStickHUD2::switchOff(%this)
{
if(%this.isAwake()) {
Canvas.popDialog(%this);
}
}
function JoyStickHUD2::changeRange(%input, %inMin, %inMax, %outMin, %outMax)
{
%f = (%input - %inMin) / (%inMax - %inMin);
return %outMin + %f * (%outMax - %outMin);
}
if ( isObject( JoyStickHUD2Map ) )
JoyStickHUD2Map.delete();
new ActionMap(JoyStickHUD2Map);
$js2hXaxisLast = 0.0;
$js2hYaxisLast = 0.0;
$js2hZaxisLast = 0.0;
$js2hRZaxisLast = 0.0;
$js2hXaxis1Last = 0.0;
$js2hYaxis1Last = 0.0;
$js2hZaxis1Last = 0.0;
$js2hRZaxis1Last = 0.0;
function js2hXaxis(%val) {
$js2hXaxisLast = %val;
JoyStickHUD2::setJSValues();
// echo("js2hXaxis = " @ %val);
}
function js2hYaxis(%val) {
$js2hYaxisLast = %val;
JoyStickHUD2::setJSValues();
}
function js2hZaxis(%val) {
$js2hZaxisLast = %val;
JoyStickHUD2::setJSValues();
}
function js2hRZaxis(%val) {
$js2hRZaxisLast = %val;
JoyStickHUD2::setJSValues();
}
JoyStickHUD2Map.bind(joystick0, "xaxis", S, 1.000, js2hXaxis);
JoyStickHUD2Map.bind(joystick0, "yaxis", SI, 1.000, js2hYaxis);
//JoyStickHUD2Map.bind(joystick0, "zaxis", S, 1.000, js2hZaxis);
JoyStickHUD2Map.bind(joystick0, "slider", SI, 1.000, js2hZaxis);
JoyStickHUD2Map.bind(joystick0, "rzaxis", SI, 1.000, js2hRZaxis);
function js2hXaxis1(%val) {
$js2hXaxis1Last = %val;
JoyStickHUD2::setJSValues();
// echo("js2hXaxis1 = " @ %val);
}
function js2hYaxis1(%val) {
$js2hYaxis1Last = %val;
JoyStickHUD2::setJSValues();
}
function js2hZaxis1(%val) {
$js2hZaxis1Last = %val;
JoyStickHUD2::setJSValues();
}
function js2hRZaxis1(%val) {
$js2hRZaxis1Last = %val;
JoyStickHUD2::setJSValues();
}
JoyStickHUD2Map.bind(joystick1, "xaxis", S, 1.000, js2hXaxis1);
JoyStickHUD2Map.bind(joystick1, "yaxis", SI, 1.000, js2hYaxis1);
JoyStickHUD2Map.bind(joystick1, "zaxis", S, 1.000, js2hZaxis1);
JoyStickHUD2Map.bind(joystick1, "rzaxis", SI, 1.000, js2hRZaxis1);
// Call this in main menu to enable the sticks: JoyStickHUD2.testInit();
// Needed to run this HUD from the main menu.
function JoyStickHUD2::testInit(%this)
{
$enableDirectInput = "1";
activateDirectInput();
// turn this off for Main Menu
JoyStickHUD2.noCursor = "0";
JoyStickHUD2.switchOn();
}
Employee Michael Perry
ZombieShortbus