Always Point to Camera

Hello,

How do I make a polygon (quad, or sprite-like polygon) always be pointing to the camera? I believe this has something to do with matrices and getting vectors from the modelview matrix, but I’m kinda inexperienced with matrix operation/information.

Thanks.

Are you talking about billboarding?
Or sort of like an overlay, like a space ship’s control’s or user stat’s.

In billboarding you just rotate the object in reference to the camera position, look at vector math, sin/cos.

Like an overlay would work like this…
Just draw it before using gluLookAt or glRotate or gltranslate.
Only thing drawn after will be moved.

Originally posted by JohnnyM:
[b]Hello,

How do I make a polygon (quad, or sprite-like polygon) always be pointing to the camera? I believe this has something to do with matrices and getting vectors from the modelview matrix, but I’m kinda inexperienced with matrix operation/information.

Thanks.[/b]

i think he meant billboarding…anyway, if it’s billboarding, search around the net for it, there’re lots of sites about it (and codes too! =) ).

if it’s overlay, well, i have a diff. way of creating an overlay than nexusone, i push my matrices and then switch to ortho mode, then draw whatever i want to draw in 2d (like mouse cursor =) ), then switch back to perspective mode…i think there’s a tutorial on this at gametutorials.com (not sure though)…i thought of this method myself after needing a mouse cursor… .

I also do that switching between ortho and perspective, when using bitmap text.

Originally posted by nomad82:
[b]i think he meant billboarding…anyway, if it’s billboarding, search around the net for it, there’re lots of sites about it (and codes too! =) ).

if it’s overlay, well, i have a diff. way of creating an overlay than nexusone, i push my matrices and then switch to ortho mode, then draw whatever i want to draw in 2d (like mouse cursor =) ), then switch back to perspective mode…i think there’s a tutorial on this at gametutorials.com (not sure though)…i thought of this method myself after needing a mouse cursor… .[/b]