Returns right analog stick horizontal axis value with direction parameter.
Takes controller (controller handle from inpCreateController, positive integer), direction (0=left, 1=right, controls return value sign/interpretation).
Returns integer axis value (-32768 to +32767 range, sign depends on direction parameter).
Input
Parameters & Returns
Parameters
controllerInt
directionInt
Returns
Int
Quick Summary
Returns right analog stick horizontal axis value with direction parameter.
Takes controller (controller handle from inpCreateController, positive integer), direction (0=left, 1=right, controls return value sign/interpretation).
Returns integer axis value (-32768 to +32767 range, sign depends on direction parameter).
Technical Exegesis...
Returns right analog stick horizontal axis value with direction parameter. Takes controller (controller handle from inpCreateController, positive integer), direction (0=left, 1=right, controls return value sign/interpretation). Returns integer axis value (-32768 to +32767 range, sign depends on direction parameter). Queries right stick X-axis for analog camera/aiming input.
Returns right analog stick horizontal axis value with direction parameter. Takes controller (controller handle from inpCreateController, positive integer), direction (0=left, 1=right, controls return value sign/interpretation). Returns integer axis value (-32768 to +32767 range, sign depends on direction parameter). Queries right stick X-axis for analog camera/aiming input.
Axis value: returns analog stick position on X-axis, -32768=full left, 0=centered/neutral, +32767=full right, magnitude indicates how far stick pushed (32767=maximum displacement, 16384=half displacement), includes deadzone filtering (small movements near center ignored to prevent drift).
Direction parameter: 0=left (returns positive value when stick pushed left, negative when right), 1=right (returns positive value when stick pushed right, negative when left), allows checking specific direction (If inpRightStickHitX(ctrl%, 1)>threshold Then rotating right), different from reading raw axis (raw would require sign checking).
Use cases: (1) Camera rotation (horizontal camera yaw control in FPS/TPS games), (2) Aiming (horizontal aim adjustment in shooters), (3) Turret control (rotate turret/weapon horizontally), (4) Vehicle camera (look around in driving games), (5) Cursor control (analog cursor movement in strategy/UI).
Common patterns: camera yaw = cameraYaw#=cameraYaw#+inpRightStickHitX(controller%, 1)/32767.0*rotSpeed# (normalize and apply rotation); sensitivity = stickX#=inpRightStickHitX(ctrl%, 1)/32767.0*sensitivity#: cameraYaw#=cameraYaw#+stickX# (adjustable sensitivity); aim assist = aimX#=inpRightStickHitX(ctrl%, 1)/32767.0 (read normalized aim input).
Normalization: convert to -1.0 to +1.0 float range (value# = axis% / 32767.0), useful for rotation calculations (rotation# = normalizedAxis# * rotSpeed#), preserves analog precision (full range of stick movement), typical multiplier 0.05-0.2 for camera rotation (similar to mouse sensitivity).
Deadzone: built-in deadzone filtering applied (small values near center returned as 0), prevents stick drift (worn controllers report non-zero when centered), typical deadzone ~8000-10000 (about 25% of full range), larger deadzone improves aiming precision (reduces unintentional movement).
Camera control: right stick typically controls camera in console games (standard FPS/TPS layout), horizontal axis controls yaw (left/right rotation), pattern: yaw#=yaw#+inpRightStickHitX(ctrl%, 1)/32767.0*yawSpeed#: pitch#=pitch#-inpRightStickHitY(ctrl%, 0)/32767.0*pitchSpeed#, clamp pitch to prevent gimbal lock (typically -89 degrees to +89 degrees).
Inverted controls: some players prefer inverted camera controls (use direction=0 instead of 1 for reversed behavior), user option recommended (allow players to toggle inversion), pattern: If invertX Then dir=0 Else dir=1: rotation=inpRightStickHitX(ctrl%, dir).
Controller requirements: requires inpUpdateController called each frame (updates stick state from hardware), returns 0 if controller disconnected (check inpIsControllerConnected first), right stick typically used for camera (left stick for movement in FPS games).
Performance: fast query (~0.001ms, simple state lookup), safe for per-frame calls (intended usage pattern), no controller update required (reads cached state from last inpUpdateController).
Axis range: -32768 to +32767 (16-bit signed integer, standard XInput range), 0=neutral/centered (stick not pushed), positive/negative depends on direction parameter (0=left positive, 1=right positive), magnitude indicates displacement (larger absolute value=farther from center).
Return values: -32768 to +32767 analog axis value (sign depends on direction), 0 if stick centered or disconnected, 0 on error (invalid controller handle).