PDA

View Full Version : Beamweapon Billboarding



Ikaruga
09-09-2004, 07:34 PM
I've been thinking about this for a few days but my brain is fried, so I'll try and get some outside input to see what other people think.

I want to use a sort of billboarding effect, but not in the standard sense. What I want to be able to do is draw beam-weapon type effects, which can be drawn with a quad and will look the same from--almost--any angle.

The method I thought of was supplying a function with a vector which would become the Z axis. The Y axis would point directly at the viewer. YxZ would produce the X axis, and then I should be able to just draw a quad in the XZ plane and have it show up properly, as long as the Z axis is not nearly colinear with the Y axis through the viewer, right?

But for some reason it's giving me mucho trouble. Have I done something horrendously wrong? One thing giving me trouble is keeping everything in the same space; while I can easily specify the Z vector in world space, the Y vector can most easily be taken out of the right column of the modelview matrix, but that will be in eye space. I want to avoid having to pass a ->camera vector to the function so when I implement a class hierarchy of objects that will inhabit the game world I won't have to worry about beam weapons knowing which camera is "turned on."

Perhaps my math is just wrong?

Ikaruga
09-10-2004, 04:32 PM
I fixed it. I'm a such a moron, I had a wrong coefficient in my cross product function!