Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From the POV of the terrain, yes, the camera is rotating. But, since your view is from the POV of the camera, when you rotate the camera, it appears that the terrain is rotating. This is the behavior that <a href="http://www.opengl.org/resources/faq/technical/viewing.htm" rel="nofollow noreferrer">gluLookAt()</a> is intended to produce. If there is something else that you expected, you will need to rotate only the geometry that you want rotated, and not try to rotate using gluLookAt().</p> <p>Update 1: Based on the discussion below, try this:</p> <pre><code>void Camera::RotateCamera(float h, float v) { hRadians += h; vRadians += v; cam_norm.x = cos(vRadians) * sin(hRadians); cam_norm.y = -sin(vRadians); cam_norm.z = cos(vRadians) * sin(hRadians); cam_up.x = sin(vRadians) * sin(hRadians); cam_up.y = cos(vRadians); cam_up.z = sin(vRadians) * cos(hRadians); } void Camera::Place() { //position, camera target, up vector gluLookAt(cam_pos.x, cam_pos.y, cam_pos.z, cam_pos.x+cam_norm.x, cam+pos.y+cam_norm.y, camp_pos.z+cam_norm.z, cam_up.x, cam_up.y, cam_up.z); } </code></pre> <p>Separating the camera normal (the direction the camera is looking) from the position allows you to independently change the position, pan and tilt... that is, you can change the position without having to recompute the normal and up vectors.</p> <p>Disclaimer: This is untested, just what I could do on the back of a sheet of paper. It assumes a right handed coordinate system and that pan rotation is applied before tilt.</p> <p>Update 2: Derived using linear algebra rather than geometry... again, untested, but I have more confidence in this.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload