N00b Help with OpenGL :)

Started by
2 comments, last by koniosis 20 years ago
Hey I'm new to OpenGL and I've got a problem that I can't figure out Heres what it is: I want to create a train cart (the ones that use humans to push the level up and down to make it go) and I want to do it just with OpenGL not with a modeller or anything. So basically I need an object to represent the level on the cart, something to use as arms on the people etc and some way to make them move together, so the lever goes up and down and the arms and bodies of the operators go with it. something like:



     /\   
   0/  \     0
   |   |\----|
   |   |     |
__/_\__|____/_\__
--0---------0----


with the guys arms going up and down but still holding onto the level, the whole thing will be mode of cubes and cylinders, nothing complicated. What I'm having a problem figuring out is how I can draw the level and the draw the arms so that they are attached to the end of the level but also the body of the people. I've tried using glRotatef but I can only figure out how to make the whole lot rotate, so the arms come away from the bodies. I'm probably being really dense, can some give me a bit of help pls. Thanks [edited by - koniosis on April 11, 2004 9:28:08 AM]
Advertisement
Do you want the body to rotate too, or are you going to have elbo joints (with no elbos you cant do the motion without moving your body, or do you care if your arms stretch?) The easiest would be stretchy arms, but depending on how far away from the level (i assume an arms length) the stretching would be more obvious.

I think this is called inverse kinetics. You could give a nice effect with slight body stetching. Keep the shoulder joints allways at the same height and just move them to and away from the lever as the shoulder rotates up and down. So when the arm is level with the leverthe body is straight up and down. When the lever is either up or down the shoulder will be closer to the lever and will stretch the body forward. Or just search on IK.
Perhaps this could help you.

If you want a translation or rotation to effect just a certain set of polygons then you need to use glPopMatrix() before you draw them and glPushMatrix() after them.
OpenGL Revolutions http://students.hightechhigh.org/~jjensen/
except the other way around (push before pop)

This topic is closed to new replies.

Advertisement