3d rotation

I have the following code

	if ((armsraised)&&(!walking)&&(!sidestep))
    if ((armslowered)&&(!walking)&&(!sidestep))
	if ((walking)&(!sidestep))
	if ((sidestep)&&(!walking))
	if ((!walking)&&(!armsraised)&&(!armslowered)&&(!sidestep))

I am trying to get the models to be able to walk forward and backwards and sidestep left and right using the arrow keys and rotate using the mouse. The problem is with the rotation no matter what I do they always rotate around the origin and if I put the gltranslates before the glulookat then they rotate correctly but do not move correctly.
Can anyone help me fix this problem?

Putting a translation before gluLookAt doesn’t have any sense…

If you want to rotate around the robot shoulder for instance, move the shoulder at the origin, then rotate and finally move the shoulder at the correct location.

I mean, in general, move to the rotation center and then rotate. But remember that this transformation are done in the reverse order and are applied to objects. So actually, you move the center of rotation to the origin.

Hoping this is clear… :slight_smile:

I am still confused since the robots rotate fine before I move them forward or backwards or side to side using the sidedistance and distance. The problem occurs when I move them away from the origin and if I do the translates bedore the glulookat then they never walk in the direction they are facing.
Can anyone help me clear up this confusion?