# 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. Index: lg3d-wonderland/src/classes/org/jdesktop/lg3d/wonderland/config/client/AvatarClientConfig.java --- lg3d-wonderland/src/classes/org/jdesktop/lg3d/wonderland/config/client/AvatarClientConfig.java Base (1.11) +++ lg3d-wonderland/src/classes/org/jdesktop/lg3d/wonderland/config/client/AvatarClientConfig.java Locally Modified (Based On 1.11) @@ -55,6 +55,7 @@ private float stepSize; private float acceleration; private float turnRate; + private float lookRate; private String username; private Color userColor; @@ -66,6 +67,7 @@ stepSize = 0.1f; // world units acceleration = 0.01f; // world units per second turnRate = 2.0f; // degrees + lookRate = 2.0f; // degrees??? cameraMode = AvatarCamera.Mode.DEFAULT; setUserColor(Color.BLACK); setUsername(null); @@ -114,6 +116,14 @@ this.turnRate = turnRate; } + public float getLookRate() { + return lookRate; + } + + public void setLookRate(float lookRate) { + this.lookRate = lookRate; + } + public AvatarCamera.Mode getCameraMode() { return cameraMode; } Index: lg3d-wonderland/src/classes/org/jdesktop/lg3d/wonderland/scenemanager/WalkBehavior.java --- lg3d-wonderland/src/classes/org/jdesktop/lg3d/wonderland/scenemanager/WalkBehavior.java Base (1.86) +++ lg3d-wonderland/src/classes/org/jdesktop/lg3d/wonderland/scenemanager/WalkBehavior.java Locally Modified (Based On 1.86) @@ -78,9 +81,12 @@ public static final float DEFAULT_STEP_SIZE = 0.1f; public static final float DEFAULT_ACCELERATION = 0.01f; // per second. public static final float DEFAULT_TURN_RATE = (float)Math.toRadians(5.0); + public static final float DEFAULT_LOOK_RATE = (float)Math.toRadians(5.0); + public static float INIT_STEP_SIZE = DEFAULT_STEP_SIZE; public static float INIT_TURN_RATE = DEFAULT_TURN_RATE; + public static float INIT_LOOK_RATE = DEFAULT_LOOK_RATE; public static float INIT_ACCELERATION = DEFAULT_ACCELERATION; private static final Logger logger = Logger.getLogger(WalkBehavior.class.getName()); @@ -94,6 +100,9 @@ val = AvatarClientConfig.getDefault().getTurnRate(); if (val > 0) INIT_TURN_RATE = (float)Math.toRadians(val); + val = AvatarClientConfig.getDefault().getLookRate(); + if (val > 0) INIT_LOOK_RATE = (float)Math.toRadians(val); + val = AvatarClientConfig.getDefault().getAcceleration(); if (val > 0) INIT_ACCELERATION = val; } @@ -258,6 +267,7 @@ float stepSize = s.getStepSize(); float turnRate = s.getTurnRate(); + float lookRate = s.getLookRate(); AvatarCamera camera = AvatarControlBehavior.getAvatarControlBehavior().aCamera; if (s.forward ) step.z -= stepSize; @@ -268,7 +278,15 @@ if (s.down ) position.y -= stepSize; if (s.turnLeft) s.rotY -= turnRate; if (s.turnRight)s.rotY += turnRate; + if (s.lookUp) s.rotX -= lookRate; + if (s.lookDown) s.rotX += lookRate; + + // Clamp X rotation (look up/down + if (s.rotX>Math.PI/2) s.rotX = (float)Math.PI/2; + if (s.rotX<-Math.PI/2) s.rotX = (float)-Math.PI/2; + + if (s.rotY>2.0f*Math.PI) s.rotY -= 2.0f*(float)Math.PI; if (s.rotY<-2.0f*Math.PI) s.rotY += 2.0*(float)Math.PI; @@ -451,6 +469,8 @@ case AVATAR_DOWN : s.down = true; break; case AVATAR_TURN_LEFT : s.turnLeft = true; break; case AVATAR_TURN_RIGHT : s.turnRight = true; break; + case AVATAR_LOOK_UP : s.lookUp = true; break; + case AVATAR_LOOK_DOWN : s.lookDown = true; break; case AVATAR_SPEED_UP : s.stepSize += DEFAULT_STEP_SIZE; @@ -587,6 +607,8 @@ case AVATAR_TURN_LEFT : s.turnLeft = false; s.left=false; break; case AVATAR_TURN_RIGHT : s.turnRight = false; s.right=false; break; case AVATAR_SPEED_DOUBLE : s.doubleSpeed = false; break; + case AVATAR_LOOK_UP : s.lookUp = false; break; + case AVATAR_LOOK_DOWN : s.lookDown = false; break; case CAMERA_CYCLE : cycleCamera = false; break; case AVATAR_SPEED_ACCELERATE: s.setAccelerate(false); break; @@ -682,6 +704,9 @@ AVATAR_SPEED_DOUBLE, AVATAR_SPEED_ACCELERATE, + AVATAR_LOOK_UP, + AVATAR_LOOK_DOWN, + TOGGLE_COLLISION_DETECTION, TOGGLE_MAIN_MENUBAR, @@ -732,6 +757,9 @@ map.put(KeyEvent.VK_Z, Action.AVATAR_STEP_LEFT); map.put(KeyEvent.VK_X, Action.AVATAR_STEP_RIGHT); + map.put(KeyEvent.VK_R, Action.AVATAR_LOOK_UP); + map.put(KeyEvent.VK_F, Action.AVATAR_LOOK_DOWN); + map.put(KeyEvent.VK_0, Action.AVATAR_RESET); map.put(KeyEvent.VK_HOME, Action.AVATAR_RESET); @@ -853,12 +927,14 @@ private class Stimulus { private float stepSize; private float turnRate; + private float lookRate; private float acceleration; private boolean forward, backward; private boolean left, right; private boolean up, down; private boolean turnLeft, turnRight; + private boolean lookUp, lookDown; private boolean doubleSpeed; private boolean accelerate; @@ -877,6 +953,7 @@ public void set(Stimulus s) { stepSize = s.stepSize; turnRate = s.turnRate; + lookRate = s.lookRate; forward = s.forward; backward = s.backward; @@ -888,12 +965,15 @@ rotY = s.rotY; turnLeft = s.turnLeft; turnRight = s.turnRight; + lookUp = s.lookUp; + lookDown = s.lookDown; } public void reset(boolean all) { if (all) { stepSize = INIT_STEP_SIZE; turnRate = INIT_TURN_RATE; + lookRate = INIT_LOOK_RATE; acceleration = INIT_ACCELERATION; } @@ -901,8 +981,9 @@ left = right = false; up = down = false; turnLeft = turnRight = false; - doubleSpeed = false; + lookUp = false; + lookDown = false; } private long accelarateStart = -1; @@ -914,6 +995,10 @@ return doubleSpeed ? turnRate*2 : turnRate; } + public float getLookRate() { + return doubleSpeed ? lookRate*2 : lookRate; + } + public float getStepSize() { float ss = stepSize;