Camera translations

  • Thread starter _Nate_
  • Start date
20
0

Main Question or Discussion Point

I'm making a physics game engine, and I have some decent camera functionality.

Essentially, the camera has a translation (vector) and a rotation (quaternion), and functions exist to easily move the camera along any of seven degrees of freedom (pitch, yaw, roll, strafe, elevate, move, zoom), which all works nicely.

I would like to make a function that allows the camera to go wherever you specify with ease. Essentially, it would work like gulLookAt: you would give the function a camera and three vectors. The first is where the camera should be, the second is where the camera should look, and the third is the up vector.

Given these three vectors, how can I determine the translation (vector) and rotation (quaternion) of my camera? I don't know the math to do this.
 

Answers and Replies

fresh_42
Mentor
Insights Author
2018 Award
12,056
8,439
The beginning of every problem is to structure it, and convert it into something computable. Choose a Cartesian coordinate system with the camera at the origin. Then determine what you have (current look etc.) and what you want to achieve. If it is only a transformation in space, then you can use a series of rotations in space. It will be difficult without math, so just look at the corresponding Wikipedia article (rotation matrix) and see if it helps you.
 

Related Threads for: Camera translations

Replies
1
Views
2K
Replies
0
Views
1K
Top