Writing Joystick Code: Part 1: Difference between revisions

Jump to navigation Jump to search
(→‎Aileron, elevator and rudder: Remove redundant and confusing "squared" in the elevator axis example (cancelled by "power"); explain what "squared" does)
(→‎Aileron, elevator and rudder: Minor formal change)
Tags: Mobile edit Mobile web edit
Line 67: Line 67:
       <command>property-scale</command>
       <command>property-scale</command>
       <property>/controls/flight/elevator</property>
       <property>/controls/flight/elevator</property>
      ''<offset type="double">0.0</offset>''
       ''<factor type="double">-1.0</factor>''
       ''<factor type="double">-1.0</factor>''
       ''<power type="int">3</power>''
       ''<power type="int">3</power>''
      ''<offset type="double">0.0</offset>''
     </binding>
     </binding>
   </axis>
   </axis>
Line 78: Line 78:


<dead-band ..... : You may want a small movement around the center of the axis not to do anything. Or your joystick might be getting old, and it jitters around zero. Jittering is small, continuous value changes in the value. You can then supply a value for dead-band that will eliminate this. And it will be small. A dead-band of 1.0 means that the axis does nothing, a dead-band of 0.25 means that the axis does nothing for the first 25% of its movement.
<dead-band ..... : You may want a small movement around the center of the axis not to do anything. Or your joystick might be getting old, and it jitters around zero. Jittering is small, continuous value changes in the value. You can then supply a value for dead-band that will eliminate this. And it will be small. A dead-band of 1.0 means that the axis does nothing, a dead-band of 0.25 means that the axis does nothing for the first 25% of its movement.
<offset ..... : If you find that in its center position the axes outputs a non-zero value, you can put that same value here, with opposite + or - sign, to counter-act this. The HUD will show you if you have an offset problem, and can be used to see if you have solved it.


<factor ...... : If you find that moving an axis results in the aileron, elevator or rudder moving in the wrong direction, change the -1.0 to 1.0 or the 1.0 to -1.0. This will make it work the other way round.
<factor ...... : If you find that moving an axis results in the aileron, elevator or rudder moving in the wrong direction, change the -1.0 to 1.0 or the 1.0 to -1.0. This will make it work the other way round.


<power ...... : Sometimes the axes are too sensitive - a slight touch on aileron makes the plane barrel-roll. You can reduce this sensitivity by making the value of power more than 1. (It is a decimal number, so you can make small adjustments, but small adjustments are usually not enough to be noticible.) Never mind the maths, but the larger the value of power the less sensitive the aircraft will be to axis movement.
<power ...... : Sometimes the axes are too sensitive - a slight touch on aileron makes the plane barrel-roll. You can reduce this sensitivity by making the value of power more than 1. (It is a decimal number, so you can make small adjustments, but small adjustments are usually not enough to be noticible.) Never mind the maths, but the larger the value of power the less sensitive the aircraft will be to axis movement.
Remember: ((property+offset)*factor)^power=result


{{Note|In some joystick binding files, you'll find:
{{Note|In some joystick binding files, you'll find:
Line 89: Line 93:
and not faster in any way, therefore I prefer using ''power'' since it's then easier to change the value if needed.}}
and not faster in any way, therefore I prefer using ''power'' since it's then easier to change the value if needed.}}


<offset ..... : If you find that in its center position the axes outputs a non-zero value, you can put that same value here, with opposite + or - sign, to counter-act this. The HUD will show you if you have an offset problem, and can be used to see if you have solved it.


For aileron and rudder you replace ''>/controls/flight/elevator'' with ''/controls/flight/aileron'' and ''/controls/flight/rudder''. Don't forget to change the the name between <desc> and </desc>.
For aileron and rudder you replace ''>/controls/flight/elevator'' with ''/controls/flight/aileron'' and ''/controls/flight/rudder''. Don't forget to change the the name between <desc> and </desc>.
49

edits

Navigation menu