I am using a mouse driven camera and this is the code :
void Camera::updateCameraVectors(void)
{
// Calculate the new Front vector
glm::vec3 front;
front.x = cos(glm::radians(this->yaw)) * cos(glm::radians(this->pitch));
front.y = sin(glm::radians(this->pitch));
front.z = sin(glm::radians(this->yaw)) * cos(glm::radians(this->pitch));
glm::vec3 temp = this->front;
this->front = glm::normalize(front);
// Also re-calculate the Right and Up vector
this->right = glm::normalize(glm::cross(this->front, this->worldUp)); // Normalize the vectors, because their length gets closer to 0 the more you look up or down which results in slower movement.
this->up = glm::normalize(glm::cross(this->right, this->front));
**// this is my idea that is not working**
ball.xadj = ball.xadj - front.x;
}
I just need the right quantity to translate an object that is opposite this camera’s movement. How can I get these amounts? I thought it was the front variable but this didn’t work right.
Thanks in Advance,
Josh
Edit: Basically the ball should stay on the center of the screen.