From 2c0fcaa398e1b229aa9311d2af34d246a1f5b6cd Mon Sep 17 00:00:00 2001 From: DavidWyand-GG Date: Fri, 27 Sep 2013 12:40:54 -0400 Subject: [PATCH] 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 --- Engine/source/sim/actionMap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/sim/actionMap.cpp b/Engine/source/sim/actionMap.cpp index 125225d99..43169f471 100644 --- a/Engine/source/sim/actionMap.cpp +++ b/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 ) ); } }