09-25-2002, 10:50 AM
I've written a simple 3D engine using gluLookAt. But when I place particle emitor inside I heve a problem with correct particle viewing. Each particle has its x,y,z coordinates(particle is drawn on x+-1,y+-1 and constant z) and I know my camera position and "looking" vector. How can I rotate the particles so everytime I look at them they are rotated towards me? I've tried to compute dot product of the particle normal and view vector, then acos it and rotate the particle around y axis, but it doesn't work for all 360 degrees. With glRotatef(angle,0.0f,1.0f,0.0f)it works when I go left around it, but somewhere at 225 degrees this algorithm fails. When I go right, the image is currupted first 75 degrees, then OK. In both direction, when I go around more than once, it fails completely. Please help!