You'll need an additional vector, upDirection
, which is the unit vector pointing "up" from your camera. You can now cross-product viewDirection
and upDirection
to get rightDirection
, the vector pointing "right" from your camera.
You want to map y
deltas to motion along upDirection
(or -upDirection
) and x
deltas to motion in rightDirection
. These vectors are in world-space.
You may want to scale the translation speed to match the mouse speed. If you are using perspective projection you'll want to scale the translation speed with your model's depth with respect to your camera (The further the object is from your camera, the faster you will need to move it if you want it to match the mouse.)