Yup, looks like you've messed that up. http://en.wikipedia.org/wiki/Spherical_coordinate_systemglm::vec3 dir = glm::vec3( cos(x) * cos(y), sin(x) * cos(y), sin(y) ); // note i swapped cos/sin on Y from what the wiki states so that y=0 is down and y=pi is straight up forward = dir * speed;
I have seen that wiki article and have tried implementing it, but it doesn't work properly. It's pretty strange but when I call translateForward(), the camera moves to the left of the direction the camera is facing, and will only move vertically if the camera is facing down the Z axis. What I posted was me fiddling around until it worked as I expected it to :\.
On second thought, the way I keep track of the position is working fine because when I rotate the camera using this method:
void FreeLookCamera::rotate(const glm::vec3 &vec) {
mRotation += vec;
mViewMatrix = glm::rotate(glm::mat4(1.f), mRotation.z, glm::vec3(0.f, 0.f, 1.f));
mViewMatrix = glm::rotate(mViewMatrix, mRotation.x, glm::vec3(1.f, 0.f, 0.f));
mViewMatrix = glm::rotate(mViewMatrix, mRotation.y, glm::vec3(0.f, 1.f, 0.f));
mViewMatrix = glm::translate(mViewMatrix, mPosition);
}I start with a blank matrix, and apply the translation at the end based on the position I've accumulated in translateForward and the camera doesn't jump around at all.
I think math just hates my existence lol

Find content
Not Telling