Sign in to follow this  
fig

Verlet ragdoll bone rotation

Recommended Posts

fig    122
I've already implemented a basic verlet setup (you may have seen my previous post). I've also got a functional skeltal animation system from a previous physics attempt using Newton Game Dynamics. It's just a case of plugging in global matrix for each bone, so this code is basically ready to go. So now the problem. :) If I set up a ragdoll using particles like the image from Thomas Jakobsen's article, how can I store and update the rotations for each particle? Right now it's easy using boxes. I just assign 2 particles to use for the direction vector and 2 for the up vector. From these 4 particles (I actually use 3 on the boxes), I can derive a rotation matrix that can be applied to the visual objects. If I only have 1 particle, I can't see how to do this.
Quote:
The position and orientation for each limb (a vector and a matrix) are then derived for rendering purposes from the particle positions using various cross products and vector normalizations.
The article just brushes over this subject with this single sentence. Thanks for any pointers. fig

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
I have no knowledge on this subject, but I'll take a stab anyway. Just don't take my answer too seriously. I also haven't read the whole article, but the paragraphs above the picture seem to give a clue.

I think what you have to do is just reason out how the mesh should be oriented to make the character appear natural. For example, the the arm: The humerus connects to the shoulder in a ball joint, so it's pretty flexible. However, the elbow joint is a hinge, so you can take the cross product of the forearm and the upper arm to find the direction along the hinge. Now you have two vectors determining the orientation of the upperarm: the hinge axis, and the length of the upper arm. For the last one, take the cross product of the two you already have, depending on how you define things, this points from the center of the bone to either the bicep or the tricep. You have to be careful with this one, since on the human body (at least for me), you can't make the bicep vector antiparallel to the normal of the chest. So just compare this vector to the right torso vector and make sure it points forward. Now you have all three vectors to define the orientation. Deriving the matrix should be pretty easy now.

Share this post


Link to post
Share on other sites
fig    122
MrRowl: I had a look at your CarSim demo. From what I can make out, you add "ghost" particles to calculate orientation. I'm not the best with c++ (I use Delphi) and I can't find where you actually integrate these particles and keep them constrained. If you treat them like a normal particle, how do you attach them to the real particles and at the same time, not let the additional forces affect real ones?

This was th e idea I was hoping to use, but I'm stumped as to how i can keep them oriented in the system but not let them affect itphysically.

BTW, nice work on JigLib. I've been following the progress for a couple of years. At the time of my last post, I had no idea it was you that did this. :)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Fig, I'm almost certain that using ghost particles is the way not to go. It simply makes more sense to derive it using the way I posted above, or some other better way. Ghost particles will be harder to implement, probably much slower as well.

Share this post


Link to post
Share on other sites
Sphet    631
While I think the AP's sollution will work in the known context, I've tried to solve this problem for non-bone based mesh objects:

I have a skin mesh with a number of straps hanging off the character. Using verlet particle simulation I can get these straps to swing and collide with the character perfectly. Sadly, when I take those particles and convert them into transforms to correctly orient the bones that have the straps weighted to them, the illusion breaks down - I can't constrain rotation around the bone's forward vector to avoid twist.

I gave up on this problem instead using a collection of explicit rotation axis as the AP provided. Unfortunately, the cost of determining these and setting them up is high when we scale our game out across 20 characters each with 10+ straps/chains.

I am still trying to find a sollution that works correctly. I've tried simply using the forward vector of the two particles crossed with the previous set of simmed particles in the chain to get the rotation and build a matrix from that, but there is no way to constrain the rotation around the forward vector, as I said.

I would love to see a sollution to this, regardless of how complex or expensive since the visual fidelity is important in our case.

- S


Share this post


Link to post
Share on other sites
fig    122
Sorry, I didn't see your post before replying..

I'll probably need to read over your post 50 times before it clicks. :)

What do you think of this?

I've already implemented hinge and pin joints, so I'll be trying to reuse them in the ragdoll.

The Idea I have just now is to set up the upper body something like this..

0
|
0------0
/ \ |
/ \ |
0-----0 0
\ / |
\ / |
0 0
|
0

So the elbow should bend correctly as a hinge joint. The shoulder would be a pin/ball joint.

Say I have the shoulder and the upper arm like this..


1----2
|
|
3


Using the formula I already have, I need an up vector and a direction vector to calculate the matrix. So would I be right in thinking 1->2 would be the up vector and 2->3 would be the direction? Or maybe just wishful thinking, looking for a simple solution.. :)


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this