Thread: 3 Joints, how to Synchronise

  1. #1
    Registered User
    Join Date
    Mar 2006

    3 Joints, how to Synchronise

    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


                                  //rotate left leg relative to the body
                                  if (upper_leg)
                                                upper_leg_angle[0] = upper_leg_angle[0]+ 1.0f;
                                                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  

  2. #2
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Each section must have it's own transformation matrix since each object's position or section's position and rotation is dependent on the orientation of the section it's connected to.

    First you take the root transformation and use it as your base matrix.

    To arrive at each section's correct matrix, you concatenate the previous matrix result with the section's transformation matrix.

    So each object will have
    1. Translation matrix
    2. Rotation matrix
    3. Scaling matrix

    So if you want to transform a person an upper arm, lower arm,wrist, hand, and fingers you would do this:

    1. Compute base transformation matrix

    1. For arm-> Compute or pre-compute upper arm transformation matrix
    2. Mutiply base * arm

    1. Compute lower arm transformation matrix
    2. Multiply upper arm * lower arm

    1. Compute wrist transformation matrix
    2. Multiply lower arm * wrist

    1. Compute hand transformation matrix
    2. Multiply wrist * hand

    1. For each finger compute finger transformation matrix
    2. Multiply hand * finger matrix

    Render object.

    You can use a matrix stack to get this done quickly.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Synchronise WM_TIMERs, we're going in...
    By SMurf in forum Windows Programming
    Replies: 6
    Last Post: 02-21-2003, 05:00 PM