You can solve this problem already in world coordinates, in the particle function:
- get the distance vector from the camera to the particle - rotate this vector by the same euler angle you added to the camera angle. - get the distance vector from the rotated vector to the original vector - add this new distance vector to the particle position.
This should keep your particles in front of the camera regardless of the rotation.
i tried
Code:
var tVec[3];
var tVec2[3];
vec_diff(tVec,p.x,camera.x);
vec_rotate(tVec,camera.pan);
vec_diff(tVec2,p.x,tVec);
vec_add(p.x,tVec2);