I snapped this some messages back. I found this very helpful information. The answer to your problem lies within. If there is a function to resolve the camera pitch, bank and while using gluLookAt(), I would like to know.

Alternate option - you could use the details below to write your ownLookAT().

sine, cosine and tangent are 3 trigonometry functions which relate angles and lengths of sides of a right triangle and are defined this way

T = the angle of interest

A = side of triangle Adjacent to T

O = side of triangle Opposide T

H = the hypotenuse (sp?) (angle opposite the right angle).

```````````b```````````/|`

`````````/`|````` ````````/``|````` ````H``/```|````` ``````/````|`

O``````/`````|````` ````/``````|``````

/`)T````|``````

a---------+`c```

``````A``````````

cos(T) = A/H

sin(T) = O/H

tan(T) = O/A

These functions are useful for all sorts of things. For example if you want to break an arbitrary vector up into x and y components, you find the angle the vector makes with the x-axis of your coordinate system and H = length of the vector and you get:

x_component_of_H = A = H*cos(T)*

y_component_of_H = O = Hsin(T)

I had to modify the drawing from the original post. Sorry who posted this, I cannot remember.

a is your camera

b is your object

c.x = object.x; //(a)

c.y = camera.y; //(b)

Return T to get your angle. This is in 2D only you can fix for 3D in the same fashion. Once you have created the right angle use pythagoras theorm to solve the whole triangle, assuming you have the x,y coords for a & b.

2 create the billboard effect (*nearly forgot send the inverted angle of your camera to glRotated(-angle , 0.0f, 1.0f, 0.0f);

this rotation is across the X,Z axis.

Cheers,

DanS

[This message has been edited by dans (edited 03-09-2000).]