dhpoware logo
navbar
home products source demos contact us
navbar navbar
box top left corner box top right corner
 
 
OpenGL Third Person Camera Demo - Part 1.

This is the third demo in the OpenGL camera demo series and it builds on the previous demo. In this demo the third person camera model is implemented. The third person camera model is also sometimes referred to as the chase camera model. The third person camera is different to the first person and flight simulation camera models in that the user does not explicitly control the third person camera.

A third person camera is attached to an object in the game world. The third person camera is typically positioned at some distance behind and above this object. As the user moves and rotates this object about the game world, the third person camera will follow this object and reposition itself so that it is always oriented behind and above this object.

The third person camera model in this demo does not implement any dampening or lag when the camera repositions itself in response to the target object being moved and rotated. This results in the camera snapping to its new position and orientation. To minimize this behavior time based movement and rotations are used. A future demo will address this problem.

Note:
1. This demo requires the Visual C++ 2010 Library Runtimes. Download instructions can be found here.

screenshot

zip file Download executable, source, and Visual C++ 2010 solution files.

Change History:

10 July 2010.
Added missing .vcxproj.filters file to the project.

13 June 2010.
Updated solution to Microsoft Visual Studio 2010.

2 February 2008.
Updated solution to Microsoft Visual Studio 2008.

24 January 2008.
Removed ball_decal_map.tga.
Added ball_color_map.jpg, floor_color_map.jpg, and floor_light_map.jpg.

main.cpp: Major rewrite to match the format and structure of the more recent OpenGL demos. Added proper text rendering support. Updated keyboard processing. Added lighting to the ball. Added a spotlight light map to the floor.

third_person_camera.h: All previously public member variables are now private member variables. Added public getter methods to access these private members. Renamed setTargetPosition() to lookAt().

third_person_camera.cpp: Removed implementation of setTargetPosition() method. Added implementation of lookAt() method.

 
box bottom left corner content box box bottom right corner
logo logo