SFML community forums

Help => General => Topic started by: k014 on May 21, 2012, 01:29:57 am

Title: xbox 360 wireless issue
Post by: k014 on May 21, 2012, 01:29:57 am
Hello!

hello!, i am implementing a camera using opengl, and i want to control it using a box360 wireless controller

i am having an issue with AxisR using a xbox360 wirelles controller

some revelant code:


std::cout
        << "(AxisR) = ("
        << Input.GetJoystickAxis(0, sf::Joy::AxisR)
        << ")"
        << std::endl;

 

and this is the console output

Code: [Select]
...
(AxisR) = (0)
(AxisR) = (0)
(AxisR) = (0)
(AxisR) = (0)

that is not touching the controller, but when i sightly touch the R Axis (RT button) and then release, now the output is

Code: [Select]
...
(AxisR) = (-100)
(AxisR) = (-100)
(AxisR) = (-100)
(AxisR) = (-100)

is like, in first place, values are from [0,100], but when input is updated, jumps to [-100, 100], and this is causing some problems in my application

this is normal, or there's a way to make this work properly?

some information:

i am using sfml on ubuntu, instaled via repositories this way: sudo aptitude install libsfml-dev

if you need more code, i can share a public repo in github :)

[attachment deleted by admin]
Title: Re: xbox 360 wireless issue
Post by: Laurent on May 21, 2012, 08:01:46 am
This might be a driver problem. Have you tried it outside SFML? There should be a small app to test joysticks on Linux.
Title: Re: xbox 360 wireless issue
Post by: MorleyDev on May 21, 2012, 09:34:34 am
Just a guess (not played around with SFML's non-keyboard controls yet) but I think the Xbox 360 gamepad has an issue where you can't use the Right Trigger and Left Trigger independently. They're treated as one axis unless you're using XInput. Not sure if that has any effect on Linux or it's just a DirectInput problem...
Title: Re: xbox 360 wireless issue
Post by: k014 on May 21, 2012, 10:52:38 am
This might be a driver problem. Have you tried it outside SFML? There should be a small app to test joysticks on Linux.

no i have not tried outside SFML yet, but i think this is a driver problem... i dont know hot to test joysticks on linux yet, needs som googling yet by my side

in OP, i've attached my main.cpp, ready for compilation using SFML, and xbox360 camera navigation ready, but... AxisR have this problem..... starts in 0, an then jumps to [-100, 100]

Just a guess (not played around with SFML's non-keyboard controls yet) but I think the Xbox 360 gamepad has an issue where you can't use the Right Trigger and Left Trigger independently. They're treated as one axis unless you're using XInput. Not sure if that has any effect on Linux or it's just a DirectInput problem...

i have no problem using LT and RT triggers independently, but both, starts from zero, and not from -100 in first place, this is fixed immedately by just touching those triggers...

my intention is to move the camera in axis Y positive using RT, and Y negative using LT, now is working, i'll share with you:
https://github.com/joecabezas/SFML_Camera_xbox360

but works only because, initial value in AxisR (Xbox's RT) are substracted by initial value in AxisZ (xbox's LT)

PD: excuse me for my bad english! :), and Laurent, u are great, thank you for making SFML so easy and great :)
Title: Re: xbox 360 wireless issue
Post by: Laurent on May 21, 2012, 11:38:25 am
sf::Input is based on the events system. So until a "joystick moved" event happens, Input.GetJoystickAxis returns a default value of 0.

This problem is solved in SFML 2.