Joystick Sensor Axis: numAxis

numAxis
  • Returns the number of axes that the joystick has.

Type: 
  • integer
Joystick Axis Sensor:
  • Moving the joystick in the selected Axis Direction sends a positive pulse to the connected controller(s).
  • Returning the joystick to the center sends a negative pulse to the connected controller(s).
Sample Code


################  Get the number of axes that the joystick has

# import bge module
import bge

# get the controller
cont = bge.logic.getCurrentController()

# get the sensor attached to the controller
# my sensor is named Turn

sen = cont.sensors["Turn"]

# number of joystick axes?
axes = sen.numAxis