danomatika / joyosc

(maintained) hid device to osc event daemon used in the robotcowboy project
http://robotcowboy.com
GNU General Public License v3.0
44 stars 3 forks source link

triggers as axis #11

Closed polymorphicengine closed 2 weeks ago

polymorphicengine commented 2 years ago

there is the following code in GameController.cpp:

if(axis == "lefttrigger" || axis == "righttrigger") {
                return buttonPressed(axis, (event->caxis.value > 0 ? 1 : 0));
            }

with a comment that for some devices the triggers are recognised as axis.. I don't think this is a bug and i find it very useful to have the full range of sensitivity on the triggers. Removing the above lines results in a working solution.

Maybe you could add an option where one can choose how triggers should be interpreted?

danomatika commented 1 year ago

This is now a config file option, per controller in joyosc 0.5.0: https://github.com/danomatika/joyosc/blob/master/data/example_config.xml#L53

danomatika commented 1 year ago

I don't think this is a bug and i find it very useful to have the full range of sensitivity on the triggers.

I think it depends on the device. On macOS, the trigger buttons on a Playstation 3 controller only return 0 or 32767 -> essentially a binary button. This is the behavior I actually needed, in this case, so hence the current default. Other controllers might give variable responses, but I haven't personally tested one.

UPDATE: For the lower-level usage, you can always access the device as a joystick which removes the game controller mapping layer. On some novel devices, this allows for more axes or buttons than a "normal" Playstation or Xbox style controller.

danomatika commented 2 weeks ago

This was implemented in joyosc 0.5.0