Hi! im trying to get the center of the camera viewport. The basic idea is generate a particle emitter always in the center of the screen, im in 3d space and working with a moving camera. So i need to update according the camera lookAt. Im using the function
camera.getLookAtDir(); but of course the camera is not always look at the center. so i need a way to find the center of the viewport. any help? thanks!
Hi, the getLookAtDir function will return a normalized direction vector, not a position vector. So, you need to specify the distance at which you want to have this emiter and do the following vector maths
float emitterDistance = 500; // you can just use which ever number you want.
glm::vec3 emitterPos = camera.getLookAtDir() * emitterDistance + camera.getGlobalPosition();