Control key update but still an acceleration problem
This commit is contained in:
parent
44250cd124
commit
4878df85f7
@ -53,7 +53,7 @@ public class JoglMouseListener implements MouseListener, MouseMotionListener, Mo
|
||||
if(origine != null) {
|
||||
double xDiff = origine.getX() - e.getPoint().getX();
|
||||
double yDiff = origine.getY() - e.getPoint().getY();
|
||||
/* if(button == 2) {
|
||||
/* if(button == 1) {
|
||||
canvas.camera[0] += Math.cos(canvas.camera[3]) * xDiff * 0.01;
|
||||
canvas.camera[1] += Math.cos(canvas.camera[4]) * yDiff * 0.01;
|
||||
canvas.camera[2] += Math.sin(canvas.camera[3]) * xDiff * 0.01;
|
||||
|
@ -19,16 +19,40 @@ public class KeyboardListener implements KeyListener {
|
||||
|
||||
switch (e.getKeyChar()) {
|
||||
case 'z':
|
||||
canvas.camera[2] -= 0.1f;
|
||||
if(Math.abs(canvas.camera[3]) < 90 || Math.abs(canvas.camera[3])>270 ){
|
||||
canvas.camera[2] -= 0.1f;
|
||||
canvas.camera[0] += 0.1f*Math.tan(Math.toRadians(canvas.camera[3]));
|
||||
}else{
|
||||
canvas.camera[2] += 0.1f;
|
||||
canvas.camera[0] -= 0.1f*Math.tan(Math.toRadians(canvas.camera[3]));
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
canvas.camera[2] += 0.1f;
|
||||
if(Math.abs(canvas.camera[3]) < 90 || Math.abs(canvas.camera[3])>270 ){
|
||||
canvas.camera[2] += 0.1f;
|
||||
canvas.camera[0] -= 0.1f*Math.tan(Math.toRadians(canvas.camera[3]));
|
||||
}else{
|
||||
canvas.camera[2] -= 0.1f;
|
||||
canvas.camera[0] += 0.1f*Math.tan(Math.toRadians(canvas.camera[3]));
|
||||
}
|
||||
break;
|
||||
case 'q':
|
||||
canvas.camera[0] -= 0.1f;
|
||||
if(Math.abs(canvas.camera[3]) < 90 || Math.abs(canvas.camera[3])>270 ){
|
||||
canvas.camera[0] -= 0.1f;
|
||||
canvas.camera[2] -= 0.1f*Math.tan(Math.toRadians(canvas.camera[3]));
|
||||
}else{
|
||||
canvas.camera[0] += 0.1f;
|
||||
canvas.camera[2] -= 0.1f*Math.tan(Math.toRadians(canvas.camera[3]));
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
canvas.camera[0] += 0.1f;
|
||||
if(Math.abs(canvas.camera[3]) < 180 || Math.abs(canvas.camera[3])>0 ){
|
||||
canvas.camera[0] += 0.1f;
|
||||
canvas.camera[2] += 0.1f*Math.tan(Math.toRadians(canvas.camera[3]));
|
||||
}else{
|
||||
canvas.camera[0] -= 0.1f;
|
||||
canvas.camera[2] += 0.1f*Math.tan(Math.toRadians(canvas.camera[3]));
|
||||
}
|
||||
break;
|
||||
case 'a':
|
||||
canvas.camera[3] -= 1;
|
||||
|
Loading…
Reference in New Issue
Block a user