Game Development Community

Joysticks & Racing example

by Paul Griffiths · in Torque Game Engine · 06/11/2006 (9:10 pm) · 2 replies

Anyone know how to add joysticks in to Racing Example?

Ive changed the following in prefs.cs to:
$pref::Input::JoystickEnabled = "1";
$pref::Input::Sensitivity = 1;
$pref::Input::DeadZone = 0;

and in defult.bind.cs i added:

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

function joypitch(%val){
   if ($pref::Input::Deadzone < %val | - $pref::Input::Deadzone > %val)   {
      if($pref::Input::InvertMouse)      {
         $mvPitch = (- %val) * $pref::Input::Sensitivity;
      }
      else
      {

$mvPitch = %val * $pref::Input::Sensitivity;
      }
         }
   else
   {
      $mvPitch = 0;
   }
}

moveMap.bind(joystick0, "zaxis", joyyaw);
moveMap.bind(joystick0, "rzaxis", joypitch);


i added this to init.cs:

$enableDirectInput = "1";
activateDirectInput();
enableJoystick();

Im using 1.4 on windows, is there anything else i have to do?

#1
06/20/2006 (4:01 pm)
Just checking the obvious, you've deleted config.cs and config.dso from the client folder, right? Changes to default.bind.cs aren't picked up unless you delete that auto-generated, remember-the-previous-settings file. They only has to be deleted when you make a change.
#2
06/21/2006 (5:26 pm)
Thanks joey for your thread, unfortunatly the car physics isnt all that good, so will not be continuing with a car project. Thanks anyways.