Swivel / PTZ Camera

I searched the Internet for a while, for a solution without anything. I want to know how to implement the swing / swing motion in a 3D camera in OpenGL (or DirectX), as you find in Minecraft, Call of Duty, etc. I tried cycloids, while they are working, I can’t get directions for proper operation.

+3
source share
1 answer

What do you think of the following.

  • calculate cam_pos, cam_dest, cam_upas usual.
  • compute cam_rightas cross ( cam_pos, cam_up)
  • create a float camera_time(if walking, camera_time += delta_time;)
  • calculate offset_factor = sin(camera_time);

Then you can call gluLookAtor a similar function as follows.

gluLookAt(cam_pos + cam_right * offset_factor, cam_des + cam_right * offset_factort, cam_up)

. cam_up .

+5

All Articles