[2] | 1 | # This patch file was generated by NetBeans IDE
|
---|
| 2 | # This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
|
---|
| 3 | # It uses platform neutral UTF-8 encoding.
|
---|
| 4 | # Above lines and this line are ignored by the patching process.
|
---|
| 5 | Index: lg3d-wonderland/src/classes/org/jdesktop/lg3d/wonderland/config/client/AvatarClientConfig.java
|
---|
| 6 | --- lg3d-wonderland/src/classes/org/jdesktop/lg3d/wonderland/config/client/AvatarClientConfig.java Base (1.11)
|
---|
| 7 | +++ lg3d-wonderland/src/classes/org/jdesktop/lg3d/wonderland/config/client/AvatarClientConfig.java Locally Modified (Based On 1.11)
|
---|
| 8 | @@ -55,6 +55,7 @@
|
---|
| 9 | private float stepSize;
|
---|
| 10 | private float acceleration;
|
---|
| 11 | private float turnRate;
|
---|
| 12 | + private float lookRate;
|
---|
| 13 | private String username;
|
---|
| 14 | private Color userColor;
|
---|
| 15 |
|
---|
| 16 | @@ -66,6 +67,7 @@
|
---|
| 17 | stepSize = 0.1f; // world units
|
---|
| 18 | acceleration = 0.01f; // world units per second
|
---|
| 19 | turnRate = 2.0f; // degrees
|
---|
| 20 | + lookRate = 2.0f; // degrees???
|
---|
| 21 | cameraMode = AvatarCamera.Mode.DEFAULT;
|
---|
| 22 | setUserColor(Color.BLACK);
|
---|
| 23 | setUsername(null);
|
---|
| 24 | @@ -114,6 +116,14 @@
|
---|
| 25 | this.turnRate = turnRate;
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | + public float getLookRate() {
|
---|
| 29 | + return lookRate;
|
---|
| 30 | + }
|
---|
| 31 | +
|
---|
| 32 | + public void setLookRate(float lookRate) {
|
---|
| 33 | + this.lookRate = lookRate;
|
---|
| 34 | + }
|
---|
| 35 | +
|
---|
| 36 | public AvatarCamera.Mode getCameraMode() {
|
---|
| 37 | return cameraMode;
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | Index: lg3d-wonderland/src/classes/org/jdesktop/lg3d/wonderland/scenemanager/WalkBehavior.java
|
---|
| 41 | --- lg3d-wonderland/src/classes/org/jdesktop/lg3d/wonderland/scenemanager/WalkBehavior.java Base (1.86)
|
---|
| 42 | +++ lg3d-wonderland/src/classes/org/jdesktop/lg3d/wonderland/scenemanager/WalkBehavior.java Locally Modified (Based On 1.86)
|
---|
| 43 | @@ -78,9 +81,12 @@
|
---|
| 44 | public static final float DEFAULT_STEP_SIZE = 0.1f;
|
---|
| 45 | public static final float DEFAULT_ACCELERATION = 0.01f; // per second.
|
---|
| 46 | public static final float DEFAULT_TURN_RATE = (float)Math.toRadians(5.0);
|
---|
| 47 | + public static final float DEFAULT_LOOK_RATE = (float)Math.toRadians(5.0);
|
---|
| 48 |
|
---|
| 49 | +
|
---|
| 50 | public static float INIT_STEP_SIZE = DEFAULT_STEP_SIZE;
|
---|
| 51 | public static float INIT_TURN_RATE = DEFAULT_TURN_RATE;
|
---|
| 52 | + public static float INIT_LOOK_RATE = DEFAULT_LOOK_RATE;
|
---|
| 53 | public static float INIT_ACCELERATION = DEFAULT_ACCELERATION;
|
---|
| 54 |
|
---|
| 55 | private static final Logger logger = Logger.getLogger(WalkBehavior.class.getName());
|
---|
| 56 | @@ -94,6 +100,9 @@
|
---|
| 57 | val = AvatarClientConfig.getDefault().getTurnRate();
|
---|
| 58 | if (val > 0) INIT_TURN_RATE = (float)Math.toRadians(val);
|
---|
| 59 |
|
---|
| 60 | + val = AvatarClientConfig.getDefault().getLookRate();
|
---|
| 61 | + if (val > 0) INIT_LOOK_RATE = (float)Math.toRadians(val);
|
---|
| 62 | +
|
---|
| 63 | val = AvatarClientConfig.getDefault().getAcceleration();
|
---|
| 64 | if (val > 0) INIT_ACCELERATION = val;
|
---|
| 65 | }
|
---|
| 66 | @@ -258,6 +267,7 @@
|
---|
| 67 |
|
---|
| 68 | float stepSize = s.getStepSize();
|
---|
| 69 | float turnRate = s.getTurnRate();
|
---|
| 70 | + float lookRate = s.getLookRate();
|
---|
| 71 | AvatarCamera camera = AvatarControlBehavior.getAvatarControlBehavior().aCamera;
|
---|
| 72 |
|
---|
| 73 | if (s.forward ) step.z -= stepSize;
|
---|
| 74 | @@ -268,7 +278,15 @@
|
---|
| 75 | if (s.down ) position.y -= stepSize;
|
---|
| 76 | if (s.turnLeft) s.rotY -= turnRate;
|
---|
| 77 | if (s.turnRight)s.rotY += turnRate;
|
---|
| 78 | + if (s.lookUp) s.rotX -= lookRate;
|
---|
| 79 | + if (s.lookDown) s.rotX += lookRate;
|
---|
| 80 |
|
---|
| 81 | +
|
---|
| 82 | + // Clamp X rotation (look up/down
|
---|
| 83 | + if (s.rotX>Math.PI/2) s.rotX = (float)Math.PI/2;
|
---|
| 84 | + if (s.rotX<-Math.PI/2) s.rotX = (float)-Math.PI/2;
|
---|
| 85 | +
|
---|
| 86 | +
|
---|
| 87 | if (s.rotY>2.0f*Math.PI) s.rotY -= 2.0f*(float)Math.PI;
|
---|
| 88 | if (s.rotY<-2.0f*Math.PI) s.rotY += 2.0*(float)Math.PI;
|
---|
| 89 |
|
---|
| 90 | @@ -451,6 +469,8 @@
|
---|
| 91 | case AVATAR_DOWN : s.down = true; break;
|
---|
| 92 | case AVATAR_TURN_LEFT : s.turnLeft = true; break;
|
---|
| 93 | case AVATAR_TURN_RIGHT : s.turnRight = true; break;
|
---|
| 94 | + case AVATAR_LOOK_UP : s.lookUp = true; break;
|
---|
| 95 | + case AVATAR_LOOK_DOWN : s.lookDown = true; break;
|
---|
| 96 |
|
---|
| 97 | case AVATAR_SPEED_UP :
|
---|
| 98 | s.stepSize += DEFAULT_STEP_SIZE;
|
---|
| 99 | @@ -587,6 +607,8 @@
|
---|
| 100 | case AVATAR_TURN_LEFT : s.turnLeft = false; s.left=false; break;
|
---|
| 101 | case AVATAR_TURN_RIGHT : s.turnRight = false; s.right=false; break;
|
---|
| 102 | case AVATAR_SPEED_DOUBLE : s.doubleSpeed = false; break;
|
---|
| 103 | + case AVATAR_LOOK_UP : s.lookUp = false; break;
|
---|
| 104 | + case AVATAR_LOOK_DOWN : s.lookDown = false; break;
|
---|
| 105 | case CAMERA_CYCLE : cycleCamera = false; break;
|
---|
| 106 | case AVATAR_SPEED_ACCELERATE: s.setAccelerate(false); break;
|
---|
| 107 |
|
---|
| 108 | @@ -682,6 +704,9 @@
|
---|
| 109 | AVATAR_SPEED_DOUBLE,
|
---|
| 110 | AVATAR_SPEED_ACCELERATE,
|
---|
| 111 |
|
---|
| 112 | + AVATAR_LOOK_UP,
|
---|
| 113 | + AVATAR_LOOK_DOWN,
|
---|
| 114 | +
|
---|
| 115 | TOGGLE_COLLISION_DETECTION,
|
---|
| 116 | TOGGLE_MAIN_MENUBAR,
|
---|
| 117 |
|
---|
| 118 | @@ -732,6 +757,9 @@
|
---|
| 119 | map.put(KeyEvent.VK_Z, Action.AVATAR_STEP_LEFT);
|
---|
| 120 | map.put(KeyEvent.VK_X, Action.AVATAR_STEP_RIGHT);
|
---|
| 121 |
|
---|
| 122 | + map.put(KeyEvent.VK_R, Action.AVATAR_LOOK_UP);
|
---|
| 123 | + map.put(KeyEvent.VK_F, Action.AVATAR_LOOK_DOWN);
|
---|
| 124 | +
|
---|
| 125 | map.put(KeyEvent.VK_0, Action.AVATAR_RESET);
|
---|
| 126 | map.put(KeyEvent.VK_HOME, Action.AVATAR_RESET);
|
---|
| 127 |
|
---|
| 128 | @@ -853,12 +927,14 @@
|
---|
| 129 | private class Stimulus {
|
---|
| 130 | private float stepSize;
|
---|
| 131 | private float turnRate;
|
---|
| 132 | + private float lookRate;
|
---|
| 133 | private float acceleration;
|
---|
| 134 |
|
---|
| 135 | private boolean forward, backward;
|
---|
| 136 | private boolean left, right;
|
---|
| 137 | private boolean up, down;
|
---|
| 138 | private boolean turnLeft, turnRight;
|
---|
| 139 | + private boolean lookUp, lookDown;
|
---|
| 140 |
|
---|
| 141 | private boolean doubleSpeed;
|
---|
| 142 | private boolean accelerate;
|
---|
| 143 | @@ -877,6 +953,7 @@
|
---|
| 144 | public void set(Stimulus s) {
|
---|
| 145 | stepSize = s.stepSize;
|
---|
| 146 | turnRate = s.turnRate;
|
---|
| 147 | + lookRate = s.lookRate;
|
---|
| 148 |
|
---|
| 149 | forward = s.forward;
|
---|
| 150 | backward = s.backward;
|
---|
| 151 | @@ -888,12 +965,15 @@
|
---|
| 152 | rotY = s.rotY;
|
---|
| 153 | turnLeft = s.turnLeft;
|
---|
| 154 | turnRight = s.turnRight;
|
---|
| 155 | + lookUp = s.lookUp;
|
---|
| 156 | + lookDown = s.lookDown;
|
---|
| 157 | }
|
---|
| 158 |
|
---|
| 159 | public void reset(boolean all) {
|
---|
| 160 | if (all) {
|
---|
| 161 | stepSize = INIT_STEP_SIZE;
|
---|
| 162 | turnRate = INIT_TURN_RATE;
|
---|
| 163 | + lookRate = INIT_LOOK_RATE;
|
---|
| 164 | acceleration = INIT_ACCELERATION;
|
---|
| 165 | }
|
---|
| 166 |
|
---|
| 167 | @@ -901,8 +981,9 @@
|
---|
| 168 | left = right = false;
|
---|
| 169 | up = down = false;
|
---|
| 170 | turnLeft = turnRight = false;
|
---|
| 171 | -
|
---|
| 172 | doubleSpeed = false;
|
---|
| 173 | + lookUp = false;
|
---|
| 174 | + lookDown = false;
|
---|
| 175 | }
|
---|
| 176 | private long accelarateStart = -1;
|
---|
| 177 |
|
---|
| 178 | @@ -914,6 +995,10 @@
|
---|
| 179 | return doubleSpeed ? turnRate*2 : turnRate;
|
---|
| 180 | }
|
---|
| 181 |
|
---|
| 182 | + public float getLookRate() {
|
---|
| 183 | + return doubleSpeed ? lookRate*2 : lookRate;
|
---|
| 184 | + }
|
---|
| 185 | +
|
---|
| 186 | public float getStepSize() {
|
---|
| 187 | float ss = stepSize;
|
---|