Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

PhiberOptic

Facing the Screen

This topic is 5707 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This is pretty embarasing to ask, but I have never thought of the problem before. I have some quads "flying" around the screen. How can I make them always face my vector camera. (Like sprites in old 3d games, such as Duke Nukem or Doom) ?? [edited by - PhiberOptic on December 3, 2002 3:52:42 PM]

Share this post


Link to post
Share on other sites
Advertisement
Use billboarding.
You can read up on it in The Red Book or in any OpenGL programming book or reference.
Unfortunetely, I do not have a link to give you.

Hope this helps,


TommyB

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
There are many possible approaches. If your "vector camera" has up and right vectors, then an easy approach is to just draw your quads using these (unit length) vectors, e.g., define each quad with a single, central point (corresponding nicely to particle in a particle system) and generate the four vertices using this point and then up and right vectors, appropriately scaled.

Share this post


Link to post
Share on other sites
or just have all your quads (particles) share a common normal vector of 0,0,1 or something. then each frame do a single rotational interpolation between that normal vector and your camera view vector. then draw your particles with:

glPushMatrix();
glMultMatrixf(yourInterpolatedRotationAsMatrix);

drawParticles();

glPopMatrix();

as long as your default coords for your quads are consistent with the 0,0,1 normal vector that will work well, and be reletively efficient (you only needing to do one interpolation per frame for the entire quad/particle system).

but yeah, look up billboarding, that''s probably better. i just made the other thing up some time ago responding to someone elses similar question somewhere else.

-me

Share this post


Link to post
Share on other sites
I do it like this:
I push the matrix, then rotate the object with -x,-y,-z angles, draw the object, pop the matrix.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!