I have rain particles and I want to make them face the camera BUT ONLY horizontally so when the player look up, the rain should never rotate vertically or face the camera vertically.
My current code is making the particles face the camera both vertically and horizontally, how do I set static rotation vertically and make the particles only face the camera horizontally?
const D3DXMATRIX& viewMat = getCameraViewMatrix();
float f = 0.5f * particleSize;
D3DXVECTOR3 horizontal(viewMat(0,0) * f, viewMat(1,0) * f, viewMat(2,0) * f);
f = -0.5f * particleSize;
D3DXVECTOR3 vertical(viewMat(0,1) * f, viewMat(1,1) * f, viewMat(2,1) * f);
D3DXVECTOR3 view(-viewMat(0,2), -viewMat(1,2) , -viewMat(2,2));
D3DXVECTOR3 shorizontal = horizontal * particleSize;
D3DXVECTOR3 svertical = vertical * particleSize;
vertices[j*4+0] = CUSTOM_VERTEX(particlePosition + shorizontal + svertical);
vertices[j*4+1] = CUSTOM_VERTEX(particlePosition + shorizontal - svertical);
vertices[j*4+2] = CUSTOM_VERTEX(particlePosition - shorizontal - svertical);
vertices[j*4+3] = CUSTOM_VERTEX(particlePosition - shorizontal + svertical);