Game Development Community

Mapping a Racing Wheel to Yaw

by Jorge Luis Gandulfo · in Torque 3D Professional · 10/26/2009 (4:18 pm) · 0 replies

I been having some weird results trying to map a Momo Racing Wheel to drive a wheeled vehicle in T3D.

This is the code i´m using atm, obviously this is very wrong (as my knowledge on the input system is pretty reduced), and is having weird results, but is just an idea so maybe any of you can point this problem out.

Also i can't map the accelerator and break property, anybody know what axis they are handling?

function yaw2(%val)
{
   //$mvYaw += getJoystickAdjustmentAmount(%val, $lastYaw);
   //$lastYaw = %val;
   if (%val != 0)
   {
       if (%val < 0)   //go LEFT
       {
          if (%val < $lastVal)
          {
              %offset = %val - $lastVal;
          }
          else
          {
              %offset = -($lastVal - %val);
          }
       }
       else            //go RIGHT
       {
          if (%val > $lastVal)
          {
              %offset = %val - $lastVal;
          }
          else
          {
              %offset = -($lastVal - %val);
          }
       }
       $mvYaw = %offset * 2.6;
   }
   else
   {
       $mvYaw = 0;
   }
   $lastVal = %val;
}

moveMap.bind( joystick0, xaxis, yaw2 );