Displaying a CharacterClass

I am designing a class that basically can draw a character, with the member function draw().

This is half design and half implementation.

The class has following variables:
CVector3 location // cvector is struct float x, y ,z
Vector3 direction

Float rx, ry, rz // rotation variables

There are more but these are the basics. When GLUT calls the keyboard function ( member )it assesses whether to move the character or rotate.

The camera rotates around the character so the character class only cares about where it is and where its looking.

I don’t know how to do this. How could i make it so the character will rotate with right and left keys. And move towards the way its facing, with forward and back keys?


When the keyboard says to turn or move, update the rotation and location values. It’s not clear to me why you have both a direction vector and rotation values.

When it comes time to draw the character, use your values to call glTranslate to move him to the right spot and glRotate to face him in the right direction.

I need a direction vector and rotation variables because because the direction tells it what way to go but it could be moving sideways. I need the rotation variables to make him move forward.

I think