GetJoystickAxis
From Spheriki
Description of function.
Contents |
Usage
- joy number. Index of joystick with desired axis.
- axis axis value. The axis to get position of. Acceptable values are:
JOYSTICK_AXIS_X,JOYSTICK_AXIS_Y,JOYSTICK_AXIS_Z, orJOYSTICK_AXIS_R.
- Returns a value between -1 and 1.
Examples
Make sure there are available joysticks connected with GetNumJoysticks()
//Gets the X axis value of Joystick 0. var JoystickX=GetJoystickAxis(0, JOYSTICK_AXIS_X);
//Gets the Z axis value of Joystick 1. var JoystickZ=GetJoystickAxis(1, JOYSTICK_AXIS_Z);
Notes
Sphere will return an error if you give it an invalid joy value.
This function has replaced GetJoystickX() and GetJoystickY() since Sphere Version 1.14. Using them instead of GetJoystickAxis() will return an 'function undefined' error.