movedJoystickAxis() public method

public movedJoystickAxis ( int axis, int value ) : void
axis int
value int
return void
Ejemplo n.º 1
0
        private void axisMoved(int offset, int value, int range)
        {
            //indexes
            // 0 - pitch
            // 1 - roll
            // 2 - rudder
            // 3 - throttle

            // do some calculations to make it closer to [-1024, 1024]
            value -= range;
            value  = value / 32;

            if (offset.ToString() == "X")
            {
                commands.movedJoystickAxis(1, value);
            }
            else if (offset.ToString() == "Y")
            {
                commands.movedJoystickAxis(0, value);
            }
            else if (offset.ToString() == "RotationZ")
            {
                // assumes twisted rudder

                commands.movedJoystickAxis(2, value);
            }
            else if (offset.ToString() == "Z" || offset.ToString().StartsWith("Slider"))
            {
                // assumes a slider is for throttle
                // this might not be the case on the T. Flight Hotas where it is also yaw, but this should do for sticks like the 3D Pro.

                commands.movedJoystickAxis(3, value);
            }
        }