Sign in to follow this  
middy

Rotating object as camera

Recommended Posts

Hello everyone I want to rotate an object the same way as my camera. From my camera I have, an UP,DOWN, SIDE and POSITION vector. So I thought I could copy UP,DOWN, SIDE into an matrixand then do glMultmatrix(matrix) but this completely messes up my geometry. Question 1) What could I be doing wrong Question 2) Is the a better way todo this?

Share this post


Link to post
Share on other sites
See my code from a previous post it might help you:
void MoveForward()
{
GLfloat angle = 0.1;
glMatrixMode(GL_MODELVIEW);
glTranslatef(0.0, 0.0, angle);

angle=angle + 0.1;
}


void MoveBack()
{
GLfloat angle = 0.1;
glMatrixMode(GL_MODELVIEW);
glTranslatef(0.0, 0.0, -angle);

angle=angle + 0.1;
}


void StrafeRight()
{
GLfloat angle = 0.03;
glMatrixMode(GL_MODELVIEW);
glTranslatef(-angle, 0.0, 0.0);

angle=angle + 0.05;
}


void StrafeLeft()
{
GLfloat angle = 0.03;
glMatrixMode(GL_MODELVIEW);
glTranslatef(angle, 0.0, 0.0);

angle=angle + 0.05;
}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this