Camera Panning ?

Started by
1 comment, last by Endemoniada 10 years, 10 months ago

Hi guys, I'm making an editor and I need to pan the view like in a 3D modeller. My camera has a position and look, right, and up vectors. To rotate I first rotate (using quaternions) around the up for yaw, then around the (rotated) right for pitch; to zoom I move the position along the look vector. I can't figure out to pan though.

Please help. Thank you.

PS - If you use 3ds Max, I want to pan like when you hold the middle mouse button down.

Advertisement

Change the position with your current up and right vector, like so (pseudo code).

   // dx, dy are your current mouse move deltas
   camera.position += dx * camera.right + dy * camera.up;

Probably need to play with the signs (-dy * up, if your mouse y increases when moving down) and scale according to current frame delta time and some empirical value until it feels right.

Change the position with your current up and right vector, like so (pseudo code).


   // dx, dy are your current mouse move deltas
   camera.position += dx * camera.right + dy * camera.up;

Probably need to play with the signs (-dy * up, if your mouse y increases when moving down) and scale according to current frame delta time and some empirical value until it feels right.

It works like a charm now, thank you.

This topic is closed to new replies.

Advertisement