I am using Pygame 1.9.2 with Python 3.4 to create a control program for a robot. The controller is a new Xbox One controller connected via USB which is working fine 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?
Thanks
(x + 1.0) / 2.0
wherex
is whatever you get from the controller should give you a range of 0..1 (the+ 1.0
is to get you in the range0..2
)