Game Development Community

Joystick Support

by Ian George · in Torque Game Engine · 10/11/2005 (2:45 pm) · 4 replies

Sorry but how do I get my joysticks to work? how do I get to use the binding screen to bind controls of my joysticks to vehicles?

#1
10/11/2005 (4:28 pm)
1. Create a new action map (you probably have one for your keys anyway)

NOTE These are just code snippets - check the resource link below to see where it all goes.

if ( isObject( moveMap ) )
   moveMap.delete();
new ActionMap(moveMap);

2. Make a function for each direction.

function JoyMoveXAxis(%val)
{
   if ($pref::Input::Deadzone < %val | - $pref::Input::Deadzone > %val)
   {
      $mvRightAction = %val * $pref::Input::Sensitivity;
   }
   else 
  {      
      $mvRightAction = 0;
   };
}

3. bind the joystick to that function

moveMap.bind(joystick, "xaxis", JoyMoveXAxis);

4. check out this resource for more info.

**NOTE this URL doesn't work for me for some reason so if it doesn't work for you, just search for Resource 6904

http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6904
#2
10/11/2005 (5:44 pm)
Thank you Andy I will do this and try and find that resource
#3
10/15/2005 (10:52 am)
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6904

There is some extra junk in the link you posted. This link fixes it.
#4
10/15/2005 (1:47 pm)
Thanks Frank