Hi guys,
Thought I'd post a wiki article on how-to do ragdolls. It's a first-cut but hopefully it's useful to someone http://www.ogre3d.org/tikiwiki/tiki-ind ... e=Ragdolls
P.S. If an Ogre forum admin reads this can I get it moved from the Sandbox into the physics section of the wiki how-to area? I don't seem to have to permissions to create there.
Cheers
Ragdolls: A how-to guide
-
- Bugbear
- Posts: 819
- Joined: Wed May 05, 2010 4:59 am
- Location: Auckland, NZ
- x 69
-
- Gold Sponsor
- Posts: 1894
- Joined: Sun Mar 08, 2009 5:25 am
- x 116
Re: Ragdolls: A how-to guide
Nice video of the troops being killed.
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.
-
- Gremlin
- Posts: 169
- Joined: Sun Apr 29, 2012 1:03 am
- Location: Santa Monica, California
- x 19
Re: Ragdolls: A how-to guide
Nice article. I was recently working on something very similar (ragdoll type stuff with Ogre and Bullet). I ended up doing a couple of things differently on the Ogre side.
For bounding boxes, I had a bit of a problem because I had limbs that could detach and go flying. Ogre's static bounding boxes weren't working for me. I ended up modifying Ogre and got my change merged into Ogre 1.10. With my change, you can enable dynamic bounding boxes on a given entity like so:
This will make Ogre fit the bounding box around the entity's bones no matter where they go (but it will only consider bones that have influence over the mesh). There's also no need to update the scene node.
Also, instead of setting bones to be manually controlled (which kills all animation on those bones), I just set this on my Entity:
Which means Ogre won't automatically apply animation to any of the bones. Instead I update the animation on the bones manually like this (each frame):
After doing that, I can read the orientation back from the bones and feed the result into Bullet constraint motors. Then run the physics update, and after that I read the transforms back from Bullet and plug them into the bones again. This can be used for powered ragdoll.
Being able to read back the animations and then selectively change them is also useful for IK or head tracking.
For bounding boxes, I had a bit of a problem because I had limbs that could detach and go flying. Ogre's static bounding boxes weren't working for me. I ended up modifying Ogre and got my change merged into Ogre 1.10. With my change, you can enable dynamic bounding boxes on a given entity like so:
Code: Select all
mEntity->setUpdateBoundingBoxFromSkeleton( true ); // only in Ogre 1.10
Also, instead of setting bones to be manually controlled (which kills all animation on those bones), I just set this on my Entity:
Code: Select all
mEntity->setSkipAnimationStateUpdate( true );
Code: Select all
mEntity->getSkeleton()->setAnimationState( *mEntity->getAllAnimationStates() ); // push animation to skeleton bones
Being able to read back the animations and then selectively change them is also useful for IK or head tracking.
-
- Beholder
- Posts: 1512
- Joined: Fri Feb 22, 2013 4:44 am
- Location: Deep behind enemy lines
- x 139
Re: Ragdolls: A how-to guide
Great article and great tips from lunkhound. Thanks! Kudos all around 

-
- Gnoll
- Posts: 675
- Joined: Mon Aug 06, 2007 12:53 pm
- Location: Saarland, Germany
- x 64
Re: Ragdolls: A how-to guide
Hi lunkhound,
Best Regards
Lax
You are my hero!! I nearly broke my head on this topic (weeks of painfull evaluation, try and error). I wanted a partial ragdoll (animation working but letting just the right arm to be a controlled via physics). But either animations did work but there was an ugly offset between the arm and the bones or animations did not work. I solved it like you described!Also, instead of setting bones to be manually controlled (which kills all animation on those bones), I just set this on my Entity:
CODE: SELECT ALL
mEntity->setSkipAnimationStateUpdate( true );
Which means Ogre won't automatically apply animation to any of the bones. Instead I update the animation on the bones manually like this (each frame):
CODE: SELECT ALL
mEntity->getSkeleton()->setAnimationState( *mEntity->getAllAnimationStates() ); // push animation to skeleton bones
After doing that, I can read the orientation back from the bones and feed the result into Bullet constraint motors. Then run the physics update, and after that I read the transforms back from Bullet and plug them into the bones again. This can be used for powered ragdoll.
Being able to read back the animations and then selectively change them is also useful for IK or head tracking.
Best Regards
Lax
http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62