How to attach multiple capsule constraints to a character

trs79

20-10-2006 17:08:23

Hi,

I am trying to make an editor with some features similar to http://www.unrealtechnology.com/screens/phat_character.jpg

where I would like to setup multiple capsule constraints on a character's forearms, thighs, etc. I have a few questions about this:

Would I need to use NX capsules with some kind of joint constraint between each one? My idea of how this might work is you have a skeleton-rigged Ogre mesh, where each bone is bound to an NX capsule actor. However, when something collides with a capsule, it would then move the attached bone and thus the mesh? Without somekind of joint constraint on the capsules, wouldn't they just fly off into space when something collides against them?

All of the nx Character controller examples I've seen just use a single simple sphere constraint, I haven't seen any examples where you attach multiple constraints. It seems ragdolls are similar to this, but I don't know how that would tie in. I guess you could always just use a convex mesh, but it seems that mutltiple simple capsule constraints would be much faster, especially if the mesh has 5000+ tris. Thanks for any input.

betajaen

20-10-2006 17:23:42

Basically what your saying is a animated rag doll?

It can be done, but I'm not entirely sure if you can attach it via joints to the main capsule or sphere actor. You can try and prove me wrong though.

I'm pretty sure Unreal uses the character controller so it probably either attaches the bones directly, or has animated ragdoll placed within the character (with collisions disabled between ragdoll and controller). So thinking about it, yes I'm sure it can be done.

I have seen other methods that moves the bones directly, making it walk and move but you'd probably need some clever programming for it to work and it to mimic human walking.

trs79

20-10-2006 17:30:58

Thanks for the quick response. Just to clarify:

I'm pretty sure Unreal uses the character controller so it probably either attaches the bones directly,

So are you saying you attach capsule constraints to each bone? Can the character controller handle moving multiple constraints?

or has animated ragdoll placed within the character (with collisions disabled between ragdoll and controller

So in this case, would you pre-animate a ragdoll (i.e. with walking animations, running, etc.) and then that animates the bones of the Ogre mesh? Thanks!

betajaen

20-10-2006 17:39:26

Thanks for the quick response. Just to clarify:

I'm pretty sure Unreal uses the character controller so it probably either attaches the bones directly,

So are you saying you attach capsule constraints to each bone? Can the character controller handle moving multiple constraints?


The constraints would just be simple hinge and ball joints, the character controller could be the torso or perhaps a foot. But all it is really is a rag doll (demonstrated in on of the PhysX SDK tutorials).


or has animated ragdoll placed within the character (with collisions disabled between ragdoll and controller

So in this case, would you pre-animate a ragdoll (i.e. with walking animations, running, etc.) and then that animates the bones of the Ogre mesh? Thanks!


Yeah, thats one way of doing it - quite a clever way really. You have to be very careful with this, as moving the actors/bodies in the wrong position will make them jitter and perhaps "explode". But I'm sure you can do this.

The biggest problem I can see so far is the body rag doll to Ogre Skeleton, I've had some success with this but it was almost a year ago. If you are really serious about it, look at OgreNewt specifically the ragdoll demo's Skeleton to Ragdoll code, and try and convert it to work with NxOgre. The physics is the same so it won't be too hard*.




* In theory.

trs79

20-10-2006 17:48:45

Very good info, thanks. Curious, I almost think it would be easier to do things in reverse, like this:

-Animate character in Maya via traditional skeletal animations, and save them to .mesh file like usual
-Create ragdoll constraint to match bones.
-Use Ogre to play walk animations. This manually moves the ragdoll constraints.
- If character comes into contact with something, the ragdoll takes over motion and moves bones.

This way bones would usually control ragdoll, but upon collision ragdoll would control bones. This would have the advantage of letting you do the animation in Maya first. I don't know, it this a bad idea?

betajaen

20-10-2006 17:57:46

No it seems pretty sound, it's a big project though.

Of course if your willing, I'd love to have any work you do on this merged into NxOgre.

trs79

20-10-2006 18:06:54

Well if possible I'm always happy to contribute back to the community :) I was just concerned because aren't you normally not supposed to manually move nxActors, i.e. instead let the physics move them? I still think this can work though, and it seems a lot like real life--you're walking along, swinging your arms freely, then the next moment a meteor drops out of the sky, hits your arm, and you lose control of it (ok, so in real life this probably wouldn't happen, but you get my point.. :D )

It seems the forces on the arm would work to cancel each other out, i.e. the bone animation will move the joint x amount, but upon collision the ragdoll may exert greater force and overcome the bone's intended movement. But if the bone was not moving the arm at all, a collision would move the arm a greater amount then if the bone was moving at that point. At least this seems in theory to be what should happen, I may be totally off.