0

Would it be possible to represent a 3D Camera using only a Quaternion? I know that most cameras use an Up vector and a Forward vector to represent it's rotation, but couldn't the same rotation be represented as a single Quaternion with the rotation axis being forward, and the w component being the amount from the Y Axis that the camera was rotated. If there is a way to do this, any resources would be appreciated. Thanks in advance.

pdid
  • 367
  • 2
  • 15
  • 1
    Quaternions are pretty common for representing rotations. Sometimes when an object in a game provides forward / up / right vectors, those vectors are derived from the quaternion, which is the "source of truth". – Dietrich Epp Mar 23 '17 at 22:06

1 Answers1

2

In general, no, it's not possible to represent a 3D camera using only a quaternion. This is because a 3D camera not only has an orientation in space, but also a position, and a projection. The quaternion only describes an orientation.

If you're actually asking whether the rotation component of the camera object could be represented as a quaternion, then the answer in general is yes. Quaternions can be easily converted into rotation matrices (Convert Quaternion rotation to rotation matrix?), and back, so anywhere a rotation matrix is used, a quaternion could also be used (and converted to a rotation matrix where appropriate).

Community
  • 1
  • 1
MuertoExcobito
  • 9,741
  • 2
  • 37
  • 78