Gamepad Thumb Sticks And Triggers Not Working in Development FIXED

Expanding and utilizing the engine via C++.
1 post Page 1 of 1
Steve_Yorkshire
Posts: 319
Joined: Tue Feb 03, 2015 10:30 pm
 
  by Steve_Yorkshire » Thu Feb 21, 2019 1:46 am
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
1 post Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests