浏览代码

Gamepad and joystick dead zone fix

Fix for gamepad and joystick dead zone calculation so that the
calculated value will always fall within the 0..1 range.  In reference
to https://github.com/GarageGames/Torque3D/issues/468
DavidWyand-GG 12 年之前
父节点
当前提交
2c0fcaa398
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      Engine/source/sim/actionMap.cpp

+ 2 - 2
Engine/source/sim/actionMap.cpp

@@ -1508,9 +1508,9 @@ bool ActionMap::processAction(const InputEventInfo* pEvent)
             else
             {
                if( value > 0 )
-                  value = ( value - pNode->deadZoneBegin ) * ( 1.f / ( 1.f - pNode->deadZoneBegin ) );
+                  value = ( value - pNode->deadZoneEnd ) * ( 1.f / ( 1.f - pNode->deadZoneEnd ) );
                else
-                  value = ( value + pNode->deadZoneBegin ) * ( 1.f / ( 1.f - pNode->deadZoneBegin ) );
+                  value = ( value - pNode->deadZoneBegin ) * ( 1.f / ( 1.f + pNode->deadZoneBegin ) );
             }
          }