My program is of a pair of legs walking, but I dont know how to get the whole leg to Synchronise There is 3 joints that need to be considered (upper_leg, lower_leg and foot). My code is for this part is below, but is just for the upper leg. Do I do the same for the other joints or do I need to relate them in some way. The opengl website helped me a bit, but not enough to go it alone.
If you need to see any of the other code related to the walking legs, I have another post with it in. Just look for the Bobby post
cheers
Code:
glPushMatrix();
//rotate left leg relative to the body
if (upper_leg)
{
upper_leg_angle[0] = upper_leg_angle[0]+ 1.0f;
}
else
{
upper_leg_angle[0] = upper_leg_angle[0]- 1.0f;
//when the upper leg has reached its maximum angle in either
//direction it should stop and go in the opposite direction
if (upper_leg_angle[0] >=15.0f)
{
upper_leg = false;
}
if (upper_leg_angle[0] <=15.0f)
upper_leg = true
glPopMatrix();