소스 검색

Added code to reset the actions of opposite joystick
axes during analog processing. Actions were always
invoked for the active axis direction but if the
stick flipped to fast across the middle then the
reverse axis' actions were still "pressed" and would
get stuck.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9779 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

PSp..om 13 년 전
부모
커밋
33968b4c39
1개의 변경된 파일16개의 추가작업 그리고 0개의 파일을 삭제
  1. 16 0
      engine/src/core/com/jme3/input/InputManager.java

+ 16 - 0
engine/src/core/com/jme3/input/InputManager.java

@@ -324,12 +324,28 @@ public class InputManager implements RawInputListener {
         } else if (value < 0) {
             int hash = JoyAxisTrigger.joyAxisHash(joyId, axis, true);
             int otherHash = JoyAxisTrigger.joyAxisHash(joyId, axis, false);
+            
+            // Clear the reverse direction's actions in case we
+            // crossed center too quickly            
+            Float otherVal = axisValues.get(otherHash);
+            if (otherVal != null && otherVal.floatValue() > axisDeadZone) {
+                invokeActions(otherHash, false);
+            }
+            
             invokeAnalogsAndActions(hash, -value, true);
             axisValues.put(hash, -value);
             axisValues.remove(otherHash);
         } else {
             int hash = JoyAxisTrigger.joyAxisHash(joyId, axis, false);
             int otherHash = JoyAxisTrigger.joyAxisHash(joyId, axis, true);
+            
+            // Clear the reverse direction's actions in case we
+            // crossed center too quickly            
+            Float otherVal = axisValues.get(otherHash);
+            if (otherVal != null && otherVal.floatValue() > axisDeadZone) {
+                invokeActions(otherHash, false);
+            }
+            
             invokeAnalogsAndActions(hash, value, true);
             axisValues.put(hash, value);
             axisValues.remove(otherHash);