Difference between revisions of "cock.setJoystickDeadzone"
m |
m |
||
Line 1: | Line 1: | ||
Sets joystick deadzones per axis. | Sets joystick deadzones per axis. | ||
− | == | + | == Function == |
− | === | + | === Synopsis === |
<source lang="Lua">cock.setJoystickDeadzone ( self, joystick, axis, threshold )</source> | <source lang="Lua">cock.setJoystickDeadzone ( self, joystick, axis, threshold )</source> | ||
=== Arguments === | === Arguments === | ||
{{param|table|self|An object to use.}} | {{param|table|self|An object to use.}} | ||
− | {{param|number|joystick|Optional. Internal joystick number. Will use 1 if not provided.}} | + | {{param|number|joystick|Optional. |
+ | *[[Common Organization of Controls Kit Input devices|Internal joystick]] number. Will use 1 if not provided.}} | ||
{{param|string|joystick|Internal joystick name.}} | {{param|string|joystick|Internal joystick name.}} | ||
{{param|number|axis|LÖVE joystick axis.}} | {{param|number|axis|LÖVE joystick axis.}} | ||
Line 21: | Line 22: | ||
*[[cock.getJoystickDeadzone]] | *[[cock.getJoystickDeadzone]] | ||
*[[cock.setJoystickHatMode]] | *[[cock.setJoystickHatMode]] | ||
+ | *[[Common Organization of Controls Kit Input devices]] | ||
*[[Common Organization of Controls Kit Input keys]] | *[[Common Organization of Controls Kit Input keys]] | ||
*[[parent::Common Organization of Controls Kit Manual]] | *[[parent::Common Organization of Controls Kit Manual]] |
Revision as of 15:12, 2 September 2013
Sets joystick deadzones per axis.
Function
Synopsis
cock.setJoystickDeadzone ( self, joystick, axis, threshold )
Arguments
- Internal joystick number. Will use 1 if not provided.
string joystick
- Internal joystick name.
number axis
- LÖVE joystick axis.
string axis
- Axis name.
boolean axis
- Value "true" will affect all axis.
number threshold
- Deadzone threshold.
Remarks
Axis value "true" will set given threshold to all axis. Threshold value must be less than 1.
Setting a threshold results in axis readings range being "shrinked" towards the end. E.g., setting a threshold to 0.2 will only trigger joystick motion if reading surpass the threshold, but at that point it will return 0, gradually catching up with actual readings while going up to 1. This maintains entire axis range while getting rid of jittering, like when thumbstick doesn't goes to the dead center and jitters a little bit. Here's a figure displaying this:
See also
- cock.getJoystickDeadzone
- cock.setJoystickHatMode
- Common Organization of Controls Kit Input devices
- Common Organization of Controls Kit Input keys
- Common Organization of Controls Kit Manual
- Common Organization of Controls Kit