I am using Pygame 1.9.2 with Python 3.4 to create a robot control program. The controller is the new USB-connected Xbox One controller that works great with pygame. The problem is that the trigger buttons are considered Axes, which give values from -1 to 1 depending on how hard you press. Is there a way to change this to a range from 0 to 1 or any other range that does not include negative numbers?
thank
(x + 1.0) / 2.0where xis what you get from the controller should give you a range of 0..1 ( + 1.0should get you in a range 0..2)
(x + 1.0) / 2.0
x
+ 1.0
0..2
Source: https://habr.com/ru/post/1696256/More articles:The value of the drop-down list has changed by clicking only once, why? - javascriptWhy the element created by js has a different style with what I directly added to the html file - javascriptWhy is the meaning of "this" different? - javascriptПочему бы не использовать переменную Result непосредственно при возврате объекта? - delphiPygame Xbox One controller - pythonR: Copying files over the MUCH network is slower with `file.copy` than` system (mv ...) `- rCython parallelism и трафареты - pythonCan use Generics defined in Generic definition - javascriptR is the difference between the two sets in the data frame - rLock column by storing character (0) as empty rows in R - listAll Articles