PDA

View Full Version : Rotating Faces to Camera



Zadkiel
12-17-2000, 01:47 PM
Hi, I want to be able to draw some faces at paticular X,y,z coodinates and yet have them always face the camera for a particle engine. At the moment I'm using gluLookAt to position the camera but I don't mind changing to simple tranlsations or rotations if thats the only way to do it. Thanks

El Jefe
12-19-2000, 07:40 AM
Well, I do it like this...

I have a function that I pass in my current view angles. From that, it creates a forward, right, and up vector.

From here, you can use the right and up vector to calculate the vertices for your quad or triangles.

I can send some simple code to anyone that e-mails me on this topic.

pleopard
12-19-2000, 08:43 AM
The technique you described is referred to as a "Sprite". Do a web search for it. Also check these links:
http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/002315.html
http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/002013.html

http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/001709.html
http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/001137.html

shawge
12-19-2000, 09:06 AM
Search the discussion forum for "billboard". This question has been asked many times and is probably in the FAQ...

Here's the listing:
OpenGL FAQ / 9 Transformations
9.160 How can I transform an object so that it points at or follows another object or point in my scene?