glm::vec3 campos = state->getCamera()->getPosition(); glm::vec3 objToCam = campos - mPosition; objToCam = glm::normalize(objToCam); glm::vec3 upAux = glm::cross(glm::vec3(0.f, 0.f, 1.f), objToCam); float angleCos = glm::dot(glm::vec3(0.f, 0.f, 1.f), objToCam); glm::vec3 rot; rot.y = glm::degrees(glm::acos(angleCos)); // First translate so we rotate around the center of the billboard glm::mat4 rotMatrix = glm::translate(glm::mat4(), glm::vec3(-16.f, 0.f, 0.f)); rotMatrix = glm::rotate(rotMatrix, rot.y, upAux);

This isn't working as expected.

A) The billboard will follow the camera as long as I am not within a few degrees of 0 on the x axis. As I start to close in to 0 the billboard rotates back to face down the X axis.

b) Rotation of the billboard becomes whacky when I only increase the distance. It starts rotating by large amounts, and faces away from the camera.