source:
liacs/hci/src/lg3d-wonderland-camera-vertical-keybindings.patch@
163
Last change on this file since 163 was 2, checked in by , 15 years ago | |
---|---|
File size: 6.6 KB |
-
lg3d-wonderland/src/classes/org/jdesktop/lg3d/wonderland/config/client/AvatarClientConfig.java
# This patch file was generated by NetBeans IDE # This patch can be applied using context Tools: Apply Diff Patch action on respective folder. # It uses platform neutral UTF-8 encoding. # Above lines and this line are ignored by the patching process.
55 55 private float stepSize; 56 56 private float acceleration; 57 57 private float turnRate; 58 private float lookRate; 58 59 private String username; 59 60 private Color userColor; 60 61 … … 66 67 stepSize = 0.1f; // world units 67 68 acceleration = 0.01f; // world units per second 68 69 turnRate = 2.0f; // degrees 70 lookRate = 2.0f; // degrees??? 69 71 cameraMode = AvatarCamera.Mode.DEFAULT; 70 72 setUserColor(Color.BLACK); 71 73 setUsername(null); … … 114 116 this.turnRate = turnRate; 115 117 } 116 118 119 public float getLookRate() { 120 return lookRate; 121 } 122 123 public void setLookRate(float lookRate) { 124 this.lookRate = lookRate; 125 } 126 117 127 public AvatarCamera.Mode getCameraMode() { 118 128 return cameraMode; 119 129 } -
lg3d-wonderland/src/classes/org/jdesktop/lg3d/wonderland/scenemanager/WalkBehavior.java
78 81 public static final float DEFAULT_STEP_SIZE = 0.1f; 79 82 public static final float DEFAULT_ACCELERATION = 0.01f; // per second. 80 83 public static final float DEFAULT_TURN_RATE = (float)Math.toRadians(5.0); 84 public static final float DEFAULT_LOOK_RATE = (float)Math.toRadians(5.0); 81 85 86 82 87 public static float INIT_STEP_SIZE = DEFAULT_STEP_SIZE; 83 88 public static float INIT_TURN_RATE = DEFAULT_TURN_RATE; 89 public static float INIT_LOOK_RATE = DEFAULT_LOOK_RATE; 84 90 public static float INIT_ACCELERATION = DEFAULT_ACCELERATION; 85 91 86 92 private static final Logger logger = Logger.getLogger(WalkBehavior.class.getName()); … … 94 100 val = AvatarClientConfig.getDefault().getTurnRate(); 95 101 if (val > 0) INIT_TURN_RATE = (float)Math.toRadians(val); 96 102 103 val = AvatarClientConfig.getDefault().getLookRate(); 104 if (val > 0) INIT_LOOK_RATE = (float)Math.toRadians(val); 105 97 106 val = AvatarClientConfig.getDefault().getAcceleration(); 98 107 if (val > 0) INIT_ACCELERATION = val; 99 108 } … … 258 267 259 268 float stepSize = s.getStepSize(); 260 269 float turnRate = s.getTurnRate(); 270 float lookRate = s.getLookRate(); 261 271 AvatarCamera camera = AvatarControlBehavior.getAvatarControlBehavior().aCamera; 262 272 263 273 if (s.forward ) step.z -= stepSize; … … 268 278 if (s.down ) position.y -= stepSize; 269 279 if (s.turnLeft) s.rotY -= turnRate; 270 280 if (s.turnRight)s.rotY += turnRate; 281 if (s.lookUp) s.rotX -= lookRate; 282 if (s.lookDown) s.rotX += lookRate; 271 283 284 285 // Clamp X rotation (look up/down 286 if (s.rotX>Math.PI/2) s.rotX = (float)Math.PI/2; 287 if (s.rotX<-Math.PI/2) s.rotX = (float)-Math.PI/2; 288 289 272 290 if (s.rotY>2.0f*Math.PI) s.rotY -= 2.0f*(float)Math.PI; 273 291 if (s.rotY<-2.0f*Math.PI) s.rotY += 2.0*(float)Math.PI; 274 292 … … 451 469 case AVATAR_DOWN : s.down = true; break; 452 470 case AVATAR_TURN_LEFT : s.turnLeft = true; break; 453 471 case AVATAR_TURN_RIGHT : s.turnRight = true; break; 472 case AVATAR_LOOK_UP : s.lookUp = true; break; 473 case AVATAR_LOOK_DOWN : s.lookDown = true; break; 454 474 455 475 case AVATAR_SPEED_UP : 456 476 s.stepSize += DEFAULT_STEP_SIZE; … … 587 607 case AVATAR_TURN_LEFT : s.turnLeft = false; s.left=false; break; 588 608 case AVATAR_TURN_RIGHT : s.turnRight = false; s.right=false; break; 589 609 case AVATAR_SPEED_DOUBLE : s.doubleSpeed = false; break; 610 case AVATAR_LOOK_UP : s.lookUp = false; break; 611 case AVATAR_LOOK_DOWN : s.lookDown = false; break; 590 612 case CAMERA_CYCLE : cycleCamera = false; break; 591 613 case AVATAR_SPEED_ACCELERATE: s.setAccelerate(false); break; 592 614 … … 682 704 AVATAR_SPEED_DOUBLE, 683 705 AVATAR_SPEED_ACCELERATE, 684 706 707 AVATAR_LOOK_UP, 708 AVATAR_LOOK_DOWN, 709 685 710 TOGGLE_COLLISION_DETECTION, 686 711 TOGGLE_MAIN_MENUBAR, 687 712 … … 732 757 map.put(KeyEvent.VK_Z, Action.AVATAR_STEP_LEFT); 733 758 map.put(KeyEvent.VK_X, Action.AVATAR_STEP_RIGHT); 734 759 760 map.put(KeyEvent.VK_R, Action.AVATAR_LOOK_UP); 761 map.put(KeyEvent.VK_F, Action.AVATAR_LOOK_DOWN); 762 735 763 map.put(KeyEvent.VK_0, Action.AVATAR_RESET); 736 764 map.put(KeyEvent.VK_HOME, Action.AVATAR_RESET); 737 765 … … 853 927 private class Stimulus { 854 928 private float stepSize; 855 929 private float turnRate; 930 private float lookRate; 856 931 private float acceleration; 857 932 858 933 private boolean forward, backward; 859 934 private boolean left, right; 860 935 private boolean up, down; 861 936 private boolean turnLeft, turnRight; 937 private boolean lookUp, lookDown; 862 938 863 939 private boolean doubleSpeed; 864 940 private boolean accelerate; … … 877 953 public void set(Stimulus s) { 878 954 stepSize = s.stepSize; 879 955 turnRate = s.turnRate; 956 lookRate = s.lookRate; 880 957 881 958 forward = s.forward; 882 959 backward = s.backward; … … 888 965 rotY = s.rotY; 889 966 turnLeft = s.turnLeft; 890 967 turnRight = s.turnRight; 968 lookUp = s.lookUp; 969 lookDown = s.lookDown; 891 970 } 892 971 893 972 public void reset(boolean all) { 894 973 if (all) { 895 974 stepSize = INIT_STEP_SIZE; 896 975 turnRate = INIT_TURN_RATE; 976 lookRate = INIT_LOOK_RATE; 897 977 acceleration = INIT_ACCELERATION; 898 978 } 899 979 … … 901 981 left = right = false; 902 982 up = down = false; 903 983 turnLeft = turnRight = false; 904 905 984 doubleSpeed = false; 985 lookUp = false; 986 lookDown = false; 906 987 } 907 988 private long accelarateStart = -1; 908 989 … … 914 995 return doubleSpeed ? turnRate*2 : turnRate; 915 996 } 916 997 998 public float getLookRate() { 999 return doubleSpeed ? lookRate*2 : lookRate; 1000 } 1001 917 1002 public float getStepSize() { 918 1003 float ss = stepSize;
Note:
See TracBrowser
for help on using the repository browser.