Advertisement Jump to content
Mahmud Hasan

Joystick for flight simulator.

Recommended Posts

Hi guys,

I am working in a flight simulator project where I am integrating HOTAS-Warthog throttle and joystick to fly the aircraft. I am using SDL_joystick to read joystick axis data and passing that axis to a flight model library to fly the aircraft. The flight model library provide physically accurate flight behaviour.

My joystick axis values are ranging from ~ negative 32000 to 32000. I am normalizing tat value from -1 to 1 before passing that to my flight model.However, I am having some issue where my aircraft showing some unexpected behaviour. When I try to roll my air craft, the aircraft change its pitch slightly. What is happening is, while moving my joystick through x axis to roll the aircraft, the joystick giving some small value in its y axis too.

Which resulting some minor pitch changes in my aircraft. I have a dead zone configure but this is not helping and I guess it is only normal that from usability point of view, an analog joystick may give out some small value in different axis even though I am not intending to move to that axis.

My question is, is there any way to make the flight experience better by removing unexpected value from the other axis that I am not moving? The challenges here is the code should be able to filter any minor y axis value if I am moving the joystick to x axis and vice versa.

Or is there any better way to achieve my goal? Any thought?






Edited by Mahmud Hasan

Share this post

Link to post
Share on other sites

Have you tested to make sure the dead zone you configured is actually being applied? I seem to recall SDL_joystick not necessarily respecting externally-configured dead zones.

If you are implementing the dead zone in your own code, you might experiment with implementing the dead zone for each axis separately. It'll cause a slight snapping behaviour to cardinal directions, but it might work all right.

Share this post

Link to post
Share on other sites

In airplanes without flight plane auto correction, rolling actually causes the pitch of the airplane to decrease because the lift is not applied in the neutral (upwards) direction. :) This is often compensated by adjusting engine throttle and using tail elevator+rudder flaps and/or other control surfaces so as to keep the altitude unchanged.

In this case, though, it's probably the joystick's fault.

Edited by Nik02

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!