Special camera matrix construction

Hello,

I am designing a game engine as hobby project in my free time. The game will be a third-person adventure game, in the style of Diablo and Fallout, where the camera will be orbiting above the player avatar. The player is allowed to zoom in and out the camera, and rotate it around Y-axis and X-axis.

Can you help me to develop an algorithm which calculates the camera matrix? See the following diagram:

Hi Henri,

This is exactly what the gluLookAt function is for.

gluLookAt( camX, camY, camZ, orgX, orgY, orgZ, 0.0, 1.0, 0.0 )
with

R = distancecos(beta)
camX = R
cos(alpha)+orgX
camY = distancesin(beta)+orgY
camZ = R
sin(alpha)+orgZ

This page describes how the matrix is being constructed.

Cheers,

N.

Thanks for this Nico. I got similar solution by myself also.