Angular velocities

Post Reply
Blairvoyant
Posts: 11
Joined: Fri Nov 02, 2007 7:08 am

Angular velocities

Post by Blairvoyant »

I'm putting together a physics overlay for the Cal3D character animation library (or one could say, a cal3d wrapper for bullet :P) and it's working pretty amazingly well, considering how many things have gone wrong so far, but there is one more problem I need to address before I can say it's working and start cleaning up my code. That is, currently, I am simply applying angular velocities based on a given formula to individual limb segments, when I should probably be accounting for the moment of inertia of the whole thing. So, say I have a leg:

| <- Thigh
| <- Calf
L <- Foot

I know the absolute angular velocities I want to apply to each of them; for simplicity, let's say I want to give the whole leg an angular velocity of (1,0,0), being 1 rad/sec around the X-axis. If I apply that to only the thigh, the knee will bend and the calf+foot will trail behind. If I apply it to all 3, the calf pushes back on the thigh, and the foot pushes back on the calf, and the foot pulls on the knee as well... basically, the movement doesn't go as planned.

So, I think I need to account for the feedback from the calf and the foot when calculating the torque to put on the thigh...? and also take that extra torque into account when applying the angular velocity to the Calf..

How do I do this? >.<
Blairvoyant
Posts: 11
Joined: Fri Nov 02, 2007 7:08 am

Re: Angular velocities

Post by Blairvoyant »

I tried putting setlinearvelocity values using the crossproduct of the angular velocity of the parent bone with the position offset; this causes the character to 'explode' >.< but if I only use 1/3 of it or so, the animations seem a lot more fluid than without...the only problem is, unless I anchor the root in space, the character goes flying off in a random direction (presumably the average of all the velocities combined) and is unaffected by gravity (which makes sense considering I'm setting the velocity by hand..)

Maybe I should just set the torque instead? I could approximate how much is required for a parent bone by multiplying by the number of child bones (each has a mass of 1.0f at the moment) and I could clear the torque and recalculate it recursively each simulation step...I have a feeling that will do the exact same thing, though...unless there is something magical about inertia tensors which will eliminate this problem...
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Angular velocities

Post by Erwin Coumans »

That sounds interesting, could you share a demo, using a binding between Cal3D animation library and Bullet?

Which effect do you want to achieve? Why do you try to change the velocity of bodies, part of a ragdoll hierarchy?

Do you want to achieve a Naturalmotion style effect like dynamic controlled characters/ragdolls? You might want to check out the papers and open source Dance library. Dance uses ODE, but it can also use other physics engines like Bullet. Some people use joint motors to achieve such effect, but the Dance library directly affects the body velocities.
Thanks,
Erwin
Blairvoyant
Posts: 11
Joined: Fri Nov 02, 2007 7:08 am

Re: Angular velocities

Post by Blairvoyant »

Shoot..I sort of did a write-up at home but I'm at school now :P didn't expect a response so quickly..

Basically, I am implementing this design:

http://graphics.cs.williams.edu/papers/DynamoVGS06/

since it didn't seem that they had created a general-use, open-source library...at least not one distributed widely...

...but after taking a look at DANCE, it seems this may have been a pointless endeavour...I guess I'll spend some more time looking at it.
Blairvoyant
Posts: 11
Joined: Fri Nov 02, 2007 7:08 am

Re: Angular velocities

Post by Blairvoyant »

I'm not sure if y'all have a preferred file hosting service, so I googled Free File Hosting...I can put it somewhere else if you prefer:

(Win32 .exe + necessary .dll's and data)
http://www.mediafire.com/?8tnjzm9ecy1

This is a poorly-hacked version of the Cally Demo, which is the generic demoapp for Cal3d. Basically, there was just a character in the middle who would play out different animations based on the 'mixer' which combines various 'tracks'... anyway, what I changed was I added a floor, which is a big static box, and some gravity; you can press the labeled buttons in the lower right hand corner to change what animation plays, space to unpause/pause (it is paused by default, and for whatever reason only her ponytail appears until you unpause it)... the button with a picture of a bone on it will switch to a 'debug view' - blue points indicate collision points for the various convex hulls for each bone (generated automatically from the model data), red points are the desired bone positions in egocentric coordinates (thus appearing around the origin all the time) and yellow points are the red points, translated onto the character's root bone, so that you can see what the character is supposed to be approximating.

The working title of the project is 'Calibre', thus the .dll; this version is the one where *only* desired angular velocities are applied - that is, the crossproduct of the current bone orientation with the desired bone orientation. Also, the root bone is powered only by a rotational spring perpendicular to gravity, so there is nothing enforcing a particular orientation other than that.

As you can (hopefully) see, she does an all right job of staying in one position, although if she's already rotating, she will continue to do so; when she tries to walk/run/limp, her arms get caught behind her and her orientation varies almost randomly. The 'Funky' animation is supposed to be a sort of jump kick, but she does not do it with anywhere near the finesse of her physics-free counterpart.
Post Reply