Okay, a long time ago I was trying to make a way to integrate cal3d and bullet to make a sort of naturalmotion-style effect, where a character will act out its animations but also be affected by physics. I implemented it using an algorithm found here: http://graphics.cs.williams.edu/papers/DynamoVGS06/
At first it was barely workable; the character would wobble and fall down and generally fail to look like a competent human being. But on their suggestion I fiddled with damping values, restoring forces, and a few other things and now it looks somewhat better. Still far from ideal, but close enough that the smaller issues are pretty visible.
You can download a poorly-hacked demo here:
http://www.mediafire.com/?sharekey=f273 ... b9a8902bda
Left-click to rotate the camera, right click to zoom in and out, and middle-click to 'grab' the model so you can move it around (like in the official bullet demos).
One problem is that the constraints on the fingertips don't seem to do much; you can see this if you try to move her around really fast. Her hands will look like they're being stretched to the floor. It's easy to see if you change to the physics view mode (click on the spanner-looking button in the bottom left) that it's as though her thumbs fell off. Why might this be?
Natural Motion
-
- Posts: 25
- Joined: Thu Nov 29, 2007 7:08 pm
Re: Natural Motion
Hi Blairvoyant,
I tried downloading and running your app, but... "The application failed to initialize properly (0xc0150002)..."
Any ideas? Perhaps due to my glut version (3.7.6)?
Cheers,
Eddy
I tried downloading and running your app, but... "The application failed to initialize properly (0xc0150002)..."
Any ideas? Perhaps due to my glut version (3.7.6)?
Cheers,
Eddy
-
- Posts: 11
- Joined: Fri Nov 02, 2007 7:08 am
Re: Natural Motion
Seems likely; I have uploaded another .rar with the GLUT32.dll that I use...
I was getting the same error when I first tried running the app on this computer, but after re-compiling everything it worked...
I was getting the same error when I first tried running the app on this computer, but after re-compiling everything it worked...
-
- Posts: 84
- Joined: Sun Jan 07, 2007 4:29 pm
- Location: Oxford, England
Re: Natural Motion
Same error as before...
-
- Posts: 11
- Joined: Fri Nov 02, 2007 7:08 am
Re: Natural Motion
After some experimentation with a few other computers it seems that the solution is to install the visual C++ 2008 redistributable package. (it's just a few .dll's, 1.8mb)
http://www.microsoft.com/downloads/deta ... laylang=en
Also, here is the new version (compiled with /MT and without unnecessary debugging info)
http://www.mediafire.com/?sharekey=c0aa ... b9a8902bda
http://www.microsoft.com/downloads/deta ... laylang=en
Also, here is the new version (compiled with /MT and without unnecessary debugging info)
http://www.mediafire.com/?sharekey=c0aa ... b9a8902bda
-
- Posts: 25
- Joined: Thu Nov 29, 2007 7:08 pm
Re: Natural Motion
Hi Blairvoyant,
That did it, it's working on my machine now.
Cool demo!
As for what the problem is... it's hard to say just from the results. (Although, are you really representing individual fingers as bodies? If so, wow.)
Cheers,
Eddy
That did it, it's working on my machine now.
Cool demo!
As for what the problem is... it's hard to say just from the results. (Although, are you really representing individual fingers as bodies? If so, wow.)
Cheers,
Eddy
-
- Posts: 11
- Joined: Fri Nov 02, 2007 7:08 am
Re: Natural Motion
Well, my guess is that it's because I don't really understand how constraints work.
As it stands, it loads the model, and each vertex that has greater than a certain weight on a bone (50% at the moment) is added to a convex hull body. Then, a 6dof constraint is created at the joint in the bones, attaching the new body to its parent bone.
So... what exactly does bullet do to enforce these constraints? Does it just move them iteratively? Apply forces? Do I need to set more parameters?
As it stands, it loads the model, and each vertex that has greater than a certain weight on a bone (50% at the moment) is added to a convex hull body. Then, a 6dof constraint is created at the joint in the bones, attaching the new body to its parent bone.
Code: Select all
btGeneric6DofConstraint* p2p = new btGeneric6DofConstraint(
*(pBone->getbtbody()), // this bone's convex hull object
*(pParent->getbtbody()), // the parent bone's convex hull object
corebonetransform.getIdentity(), // the default transform of the bone according to cal3D
parenttransform.inverse()*corebonetransform, // the offset from the parent
true); // don't process collisions between these two bones, otherwise the character will look like its joints are dislocated
p2p->setAngularLowerLimit(btVector3(-SIMD_PI*0.25f,-SIMD_PI*0.25f,-SIMD_PI*0.25f)); // prevent the joints from bending unnaturally far
p2p->setAngularUpperLimit(btVector3(SIMD_PI*0.25f,SIMD_PI*0.25f,SIMD_PI*0.25f));
p2p->setLinearLowerLimit(btVector3(0,0,0)); // prevent the joints from sliding out of place
p2p->setLinearUpperLimit(btVector3(0,0,0));
m_vectorjoints.push_back(p2p); // add the joint to the skeleton object, mostly for deletion purposes
btWorld->addConstraint(p2p, true); // add the joint to the bullet physics pipeline
-
- Posts: 25
- Joined: Thu Nov 29, 2007 7:08 pm
Re: Natural Motion
Hmmmm.... that corebonetransform in the constructor looks fishy. (Based on the comment "the default transform of the bone according to cal3D".) What you want here is the transform to the constraint from the bone's origin (in the bone's space).
However, the first thing I would check is what's really happening to the rigid bodies to make sure you don't have a skinning problem. Can you show these without the mesh?
Cheers,
Eddy
However, the first thing I would check is what's really happening to the rigid bodies to make sure you don't have a skinning problem. Can you show these without the mesh?
Cheers,
Eddy
-
- Posts: 11
- Joined: Fri Nov 02, 2007 7:08 am
Re: Natural Motion
Yup. Just press the 'bone' button in the lower-right-hand corner of the window (see attached image.) The red dots in the middle of the platform show the 'target' bone positions, while the blue dots show the points from each convex hull rigidbody (independent of the graphical mesh.)
But hmm.. sorry, the comments were a little bit on-the-fly. The first argument (corebonetransform.getIdentity()) is just an identity transform ([1 0 0][0 1 0] [0 0 1] [0 0 0]) because the constraint is located at the origin of the child bone. The second argument (parenttransform.inverse() * corebonetransform) should in theory be the offset of the child bone's origin from the parent bone's origin; they are both defined in absolute terms, so the product should be a relative term. Maybe I messed up the math?
But hmm.. sorry, the comments were a little bit on-the-fly. The first argument (corebonetransform.getIdentity()) is just an identity transform ([1 0 0][0 1 0] [0 0 1] [0 0 0]) because the constraint is located at the origin of the child bone. The second argument (parenttransform.inverse() * corebonetransform) should in theory be the offset of the child bone's origin from the parent bone's origin; they are both defined in absolute terms, so the product should be a relative term. Maybe I messed up the math?
You do not have the required permissions to view the files attached to this post.
-
- Posts: 1
- Joined: Tue Oct 17, 2006 7:22 am
- Location: Russia
Re: Natural Motion
Excuse me, but can you make demo - there a chracter walks on bumpy terrain or steps up on a slope?
or post sources, if you drop off this project and don't mind about?
or post sources, if you drop off this project and don't mind about?