This is about drawing full-body models that work and dance like you want. However, only skeletons are covered, no mesh and skin. The wiki link has that stuff.
What u need:
Knowing structures and pointers(not really, just structs).
This is code for:
Only 1 glut example. Rest is platform independent. But can't be used in C(do in C++).
Enjoy kind peoples.
Each bone has 2 points: x1 and y1 ex. (0,0) and the second is x2 and y2 or (0,1). Now the picture we have if we drew this is a stick coming straight up from the ground, at the center of the screen. Then in the same place we give it a hole to stick another bone into it, just like toys that click together. The entire code for one bone is:
struct bone{
float x1, x2, y1, y2; //two points on graph
bone* child; //the hole/slot to append bones
};
Then we give it the points said earlier, (0,0) going to (0,1):
bone boney; // create 1 bone bone.x1 = 0; bone.y1 = 0; // (0,0) first point bone.x2 = 0; bone.y2 = 1; // (0,1) second point
becomes 
Now we need another bone because one is retarded. All we do is make another:
bone propane; // yes boomhauer, propane
Then hook it up with boney:
boney.child = &propane; // & because child is a pointer
However, there was no big reason to do that for today. It's useful later on when you want to manage entire skeletons that have string names and labels. It's for organization mostly.
Our first bone was a stick pointing straight up. The second bone's beginning is at the end of the tip of the first bone, which is (0,1) so we give propane's x1 and y1 boney's x2 and y2: (we may refer to the new bone as boney* child or itself, propane.etc)
propane.x1 = boney.x2; // or boney.child->x1 = boney.x2; propane.y1 = boney.y2; // or boney.child->y1 = boney.y2; //Now assign the tip of the second bone propane.x2 = 2; propane.y2 = 1; // (2,1)

Tah~dahh. The picture is an upside down L or T with its left arm mauled off.
If you have OpenGL:(the draw code)
glBegin(GL_LINES); glVertex3f(bone.x1,bone.y1,0.0); glVertex3f(bone.x2,bone.y2,0.0); glVertex3f(propane.x1,propane.y1,0.0); glVertex3f(propane.x2,propane.y2,0.0); glEnd(); //To animate the thing propane.y2 -= 0.1; // Bends the right arm // inward like a real arm(roughly)

If you know more, please post lots of suggestions/links to better tuts and guides. My binging skills cannot find them all(or any :[)
-----------------------------------------------------------------------------
ORIGINAL POST:
Animadead is something that pops up a lot. Do you guys use this library or know a book with better detail?
Edit: Went through this forum and found two things for starters. Book: Focus on 3D Models and an Irrlicht tutorial that moves single nodes at a time http://irrlicht.sour...example004.html.
A nice tutorial for OpenGL and using bones http://gpwiki.org/in...ic_Bones_System <-Best resource so far.
This post has been edited by Kanvus: 15 July 2009 - 05:59 AM

New Topic/Question
Reply



MultiQuote



|