Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
General
»
Need help/advice on analog stick on joysticks
Print
Pages: [
1
]
Author
Topic: Need help/advice on analog stick on joysticks (Read 1524 times)
0 Members and 1 Guest are viewing this topic.
smilesprower
Newbie
Posts: 25
Need help/advice on analog stick on joysticks
«
on:
September 25, 2015, 02:46:15 pm »
First time trying to add joystick support and having a few problems.
#1 Analog sticks don't reset back to 0,0.
#2 How do you get angles from -100 to 100.
Any advice how one would go about setting deadzones etc would be grateful.
Thanks in advance.
Logged
G.
Hero Member
Posts: 1593
Re: Need help/advice on analog stick on joysticks
«
Reply #1 on:
September 25, 2015, 03:06:20 pm »
Use the
atan2
math function to get an angle from the stick position.
Compute the distance from 0, 0 to stick position. If it's less than whatever you want your deadzone to be then ignore it.
Quote
#1 Analog sticks don't reset back to 0,0.
Maybe the problem is in your code, but we don't know.
If you mean they don't reset to 0 but to some very small value then that's not abnormal.
Logged
smilesprower
Newbie
Posts: 25
Re: Need help/advice on analog stick on joysticks
«
Reply #2 on:
September 25, 2015, 03:36:32 pm »
Thank you, very helpful.
Also is there any fix for xbox360 controller trigger axis ?
There both set for the same axis, both pressed 0, one pressed -100, other pressed +100, none pressed 0.
Can these be seperated ?
Logged
G.
Hero Member
Posts: 1593
Re: Need help/advice on analog stick on joysticks
«
Reply #3 on:
September 25, 2015, 04:07:31 pm »
Sadly, no.
Or at least not if you use only SFML. I think some people developed different input libraries using XInput but I don't know how they interface with SFML.
Logged
Print
Pages: [
1
]
SFML community forums
»
Help
»
General
»
Need help/advice on analog stick on joysticks
anything