Ejemplo n.º 1
0
        private static float GetDeltaTriggers(GamepadModel model)
        {
            var lTrigger      = ScalingUtils.ByteToFloat(model.LeftTrigger);
            var rTrigger      = ScalingUtils.ByteToFloat(model.RightTrigger);
            var deltaTriggers = rTrigger - lTrigger;

            return(ScalingUtils.SymmetricalConstrain(deltaTriggers, 1.0f) * 800.0f); // -800:800 range
        }
Ejemplo n.º 2
0
        private static float GetDirection(GamepadModel model)
        {
            const float deadZone = 0.2f;

            var leftRightStick = ScalingUtils.ShortToFloat(model.LeftThumbStick.Horizontal);

            if (leftRightStick <= deadZone && leftRightStick >= -deadZone)
            {
                leftRightStick = 0;
            }

            leftRightStick *= 0.1f; // -0.1:0.1 range


            return(ScalingUtils.SymmetricalConstrain(leftRightStick, 0.1f));
        }