Panning camera in 3d scene with keyboard


#1

Hi there

What is a good way to have the camera making a panning move when holding down the keyboard RIGHT, LEFT, UP and DOWN? I guess there is an easy way for this. I just want the same effect as when you hold down the right mouse button and move the mouse. I failed with the following:

in the update function:

if (K.isDown(K.RIGHT)){
    var vec = new h3d.Vector(1,0,0,0);
s3d.camera.pos = s3d.camera.pos.add(vec);
s3d.camera.target = s3d.camera.target.add(vec);

}