Jump to content

Gamepad Thumb Sticks And Triggers Not Working in Development FIXED


Recommended Posts

Just tested a clean version of development branch (last updated 2 Feb 2019) and found that gamepad triggers and thumb sticks do not appear to register input.

 

   // L & R Thumbsticks:
   { "thumblx",       SI_AXIS,   XI_THUMBLX     },
   { "thumbly",       SI_AXIS,   XI_THUMBLY     },
   { "thumbrx",       SI_AXIS,   XI_THUMBRX     },
   { "thumbry",       SI_AXIS,   XI_THUMBRY     },
 
   // L & R Triggers:
   { "triggerl",      SI_AXIS,   XI_LEFT_TRIGGER  },
   { "triggerr",      SI_AXIS,   XI_RIGHT_TRIGGER },

 

All other gamepad buttons work fine (D-pad, shoulder/bumpers/etc).


======================================

edit and update:


So @OTHGMars informs me that it's now using the standard joystick axis rather than thumb/trigger inputs. Y axis requires inverting the input in the same way the older SDL input did - which I'm sure I made a thread about else where :P


In scripts/client/default.bind.cs:

 

function gamePadMoveY( %val )
{
	/*
   if(%val > 0)
   {
      $mvForwardAction = %val * $movementSpeed;
      $mvBackwardAction = 0;
   }
   else
   {
      $mvForwardAction = 0;
      $mvBackwardAction = -%val * $movementSpeed;
   }
	*/
 
	//yorks changed
   if(%val > 0)
   {
      $mvForwardAction = 0;
      $mvBackwardAction = %val * $movementSpeed;
   }
   else
   {
      $mvForwardAction = -%val * $movementSpeed;
      $mvBackwardAction = 0;
   }
}
 
//...
 
function gamepadPitch(%val)
{
	/*
   %pitchAdj = getGamepadAdjustAmount(%val);
   if(ServerConnection.isControlObjectRotDampedCamera())
   {
      // Clamp and scale
      %pitchAdj = mClamp(%pitchAdj, -m2Pi()+0.01, m2Pi()-0.01);
      %pitchAdj *= 0.5;
   }
 
   if(%pitchAdj > 0)
   {
      $mvPitchDownSpeed = %pitchAdj;
      $mvPitchUpSpeed = 0;
   }
   else
   {
      $mvPitchDownSpeed = 0;
      $mvPitchUpSpeed = -%pitchAdj;
   }
   */
   %pitchAdj = getGamepadAdjustAmount(%val);
   if(ServerConnection.isControlObjectRotDampedCamera())
   {
      // Clamp and scale
      %pitchAdj = mClamp(%pitchAdj, -m2Pi()+0.01, m2Pi()-0.01);
      %pitchAdj *= 0.5;
   }
 
	if(%pitchAdj > 0)
   {
      $mvPitchDownSpeed = 0;
      $mvPitchUpSpeed = %pitchAdj;//swap to positive for sdl
   }
   else
   {
      $mvPitchDownSpeed = -%pitchAdj;//swapped to negative for sdl
      $mvPitchUpSpeed = 0;
   }
}
 
//...
 
//moveMap.bind( gamepad, thumbrx, "D", "-0.23 0.23", gamepadYaw );
//moveMap.bind( gamepad, thumbry, "D", "-0.23 0.23", gamepadPitch );
moveMap.bind( gamepad, rxaxis, "D", "-0.23 0.23", gamepadYaw );
moveMap.bind( gamepad, ryaxis, "D", "-0.23 0.23", gamepadPitch );
//moveMap.bind( gamepad, thumblx, "D", "-0.23 0.23", gamePadMoveX );
//moveMap.bind( gamepad, thumbly, "D", "-0.23 0.23", gamePadMoveY );
moveMap.bind( gamepad, xaxis, "D", "-0.23 0.23", gamePadMoveX );
moveMap.bind( gamepad, yaxis, "D", "-0.23 0.23", gamePadMoveY );
 
//...
 
//moveMap.bind(gamepad, triggerr, gamepadFire);
//moveMap.bind(gamepad, triggerl, gamepadAltTrigger);
moveMap.bind(gamepad, rzaxis, gamepadFire);
moveMap.bind(gamepad, zaxis, gamepadAltTrigger);

 

And remember to delete/clean scripts/client/config.cs so the new values populate to your current input map. (I tend to just comment execing it out in scripts/client/init.cs when I'm testing but that prevents key remapping).


Anyhow, et voila, gamepad fully working. :P

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...