KX_PythonJoystick
Base class: EXP_PyObjectPlus
A Python interface to a joystick.
The name assigned to the joystick by the operating system. (read-only)
Type: string
activeButtons
Section titled “activeButtons”A list of active button values. (read-only)
Type: list
axisValues
Section titled “axisValues”The state of the joysticks axis as a list of values numAxis long. (read-only).
Type: list of ints.
Each specifying the value of an axis between -1.0 and 1.0 depending on how far the axis is pushed, 0 for nothing. The first 2 values are used by most joysticks and gamepads for directional control. 3rd and 4th values are only on some joysticks and can be used for arbitary controls.
- left:[-1.0, 0.0, …]
- right:[1.0, 0.0, …]
- up:[0.0, -1.0, …]
- down:[0.0, 1.0, …]
hatValues (Deprecated. Use :data:activeButtons instead)
Section titled “hatValues (Deprecated. Use :data:activeButtons instead)”The state of the joysticks hats as a list of values numHats long. (read-only).
Type: list of ints
Each specifying the direction of the hat from 1 to 12, 0 when inactive.
Hat directions are as follows…
- 0:None
- 1:Up
- 2:Right
- 4:Down
- 8:Left
- 3:Up - Right
- 6:Down - Right
- 12:Down - Left
- 9:Up - Left
numAxis
Section titled “numAxis”The number of axes for the joystick at this index. (read-only).
Type: integer
numButtons
Section titled “numButtons”The number of buttons for the joystick at this index. (read-only).
Type: integer
numHats (Deprecated. Use :data:numButtons instead)
Section titled “numHats (Deprecated. Use :data:numButtons instead)”The number of hats for the joystick at this index. (read-only).
Type: integer
startVibration()
Section titled “startVibration()”Starts the vibration.
Returns: None
stopVibration()
Section titled “stopVibration()”Stops the vibration.
Returns: None
strengthLeft
Section titled “strengthLeft”Strength of the Low frequency joystick’s motor (placed at left position usually).
Type: float (0.0 to 1.0)
strengthRight
Section titled “strengthRight”Strength of the High frequency joystick’s motor (placed at right position usually).
Type: float (0.0 to 1.0)
duration
Section titled “duration”Duration of the vibration in milliseconds.
Type: integer (0 to infinite)
isVibrating
Section titled “isVibrating”Check status of joystick vibration
Type: bool (true vibrating and false stopped)
hasVibration
Section titled “hasVibration”Check if the joystick supports vibration
Type: bool (true supported and false not supported)
Not in the Range documentation
Section titled “Not in the Range documentation”These items exist in the engine but were not in the Range documentation. The ones marked new in Anastacio were added by Anastacio Engine.
stopVibration()
Section titled “stopVibration()”method
Stops the gamepad vibration.
duration
Section titled “duration”attribute
Vibration duration, in milliseconds.
hasVibration
Section titled “hasVibration”attribute · read-only
True if the gamepad supports vibration.
inputs
Section titled “inputs”attribute · read-only
Dictionary {button: SCA_InputEvent} with the state of each gamepad button.
isVibrating
Section titled “isVibrating”attribute · read-only
True while the gamepad is vibrating.
strengthLeft
Section titled “strengthLeft”attribute
Left vibration motor strength (0 to 1).
strengthRight
Section titled “strengthRight”attribute
Right vibration motor strength (0 to 1).
