Joystick Sensor Axis: threshold

threshold
  • gets/sets the amount the joystick has to move from the center position before the sensor is triggered

Type: 
  • integer

Range:

  • 32767 to -32767
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 joystick threshold

# 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"]

# get amount joystick has to move
amount = sen.threshold
 
Sample Code


################  Set joystick threshold

# 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"]

# set the joystick threshold
sen.threshold = 750