Simulating Human with Rigid Body Joints

Started by
12 comments, last by adriansnetlis 7 years, 11 months ago

I am willing to simulate a human in Blender Game Engine(which uses Bullet as physics engine) using rigid body joints. I want to set several human parts to be several rigid body objects(with maximally realistic parameters like mass, etc.). It may propably be like this:

[attachment=31593:Idea.png]

The proportions and shapes of the parts are not as they'll be in final, but their count and approximate placement idea must be clear for you.

What I want to know:

  • What is approximate weight distribution between theese parts for normal man and normal woman?
  • How to calculate balance, what torques do I need to apply at each part to make it as ballanced as possible?
  • How do I correctly apply different tasks(using torques, propably), e.g. walking, hitting with arm, jumping, etc.?
  • What's the best way to simulate reflexes(e.g. touching hot surface, being cut, etc.)?

Thanks!;)

Advertisement

It would probably be a lot more easy to just bake animations for walking, punching etc. rather than calculating all the torques necessary to do these types of things. The forces involved in just standing up are pretty complex, and you don't want to waste CPU time having your character just stand.

You can use physics simulation when the person is actually at the mercy of physics, like when he is dead, or thrown back or something. That is called rag doll physics, but most games don't bother simulating physics for ordinary tasks.

My CVMy money management app: ELFSHMy game about shooting triangles: Lazer of Death

The ragdoll functioning is a monstrous thing that I can never understand, nor manage to make(even if every code line and setup part is told to me). That's why I am making physics model. This is more like gone be a template for BGE users. Propably this thing would be very useful for, for example, fighting games, parkour games etc. I think that it is worth to make;)


What is approximate weight distribution between theese parts for normal man and normal woman?

I never found data about this, so calculating mass from the volume of the collision shape capsule.


How to calculate balance, what torques do I need to apply at each part to make it as ballanced as possible?

I'm using Newton which is very accurate and can simulate a powered ragdoll using powered joints,
so i luckily don't need to do a custom torque solver, like anyone else has to.


How do I correctly apply different tasks(using torques, propably), e.g. walking, hitting with arm, jumping, etc.?

Balancing is the basis of any upright motion, i use a inverted pendulum model and IK solvers to apply it to the ragdoll.
Inverted pendulum is a system of position dependent acceleration leading to complex equations.

What's the best way to simulate reflexes(e.g. touching hot surface, being cut, etc.)?

A reflex might be caused by loosing balance, Inverted Pendulum has analytical answers if and when this will happen.




Warning:
This is very hard and takes a lot of time. I work >5 years on this and could have done a lot of hand made animation in that time :)
I'm self taught and assume someone with very good math background can do it 10 times faster, but think about it before you start.
There is a high chance of failure.

This is what i have so far:

Your work looks cool.

OK! So my question is - how does human actually balance himself(to not to fall down)? It's currently my aim topic. I think that I'm gone build this step by step basing on importancee. First thing, of course, is to make him stand:)

So my question is - how does human actually balance himself(to not to fall down)?


There are basically two independent problems:

1. Physics simulation:
Imagine a human standing on only one leg. That's a system of 20 bodies and the foot body and ankle joint has to carry all the weight.
Mass ratio here is 1:50, worst case for game physics libs. Bullet can't even simulate a stack of a few equal mass bodies without jitter (the last time i've checked),
and also it may miss the necessary features for powered joints. So it's not the best choice for a demanding simulation like this and you'll have to add a lot of work,
probably ending up doing your own constraint solver.
I have experience with Bullet, Havok and ODE, but when i tried Newton i was blown away by the difference in stability, accuracy and robustness it offers.
It's by far the best library for this kind of simulation - sadly only few people know about this.
I would consider using Newton instead Bullet - no matter how much effort it takes to integrate it to the blender engine, it will pay off.

Other options would be:
* Simulate in smaller timesteps or use more substeps. That way the problem becomes easier for the physics lib to solve (at the cost of performance).
(Actually all research papers i know on the topic mention that practice - they use much higher settings than actual games do.)

* Cheat and use external forces to stabilize the system :)
(I assume Natural Motion does this, but that's just an assumption)



2. Control the simulation.
For the balancing i'll explain how i do it, but there are lots of totally different approaches.

There is the well studied control problem of balancing a Inverted Pendulum on a moving cart ( = balancing a stick with your hand).
See there at the picture in the middle: http://www.elysium-labs.com/robotics-corner/learn-robotics/biped-basics/zero-moment-point-zmp/

So, by moving the cart left and right, the stick can be balanced to stay upright.
Same is for human feet, but instead moving the cart we move the center of pressure between heel and toes.
Those limits also define the min / max angular acceleration the ankle joint can apply to the center of mass of the humkan body without tipping over.

Controlling this system with max efficiency is harder than it sounds, but you see the nice simplification from a 20 to a 2 bodies system.
To use it for the real ragdoll i use this procedure each simulation step:
* Divide the ragdoll into two groups of bodies, most likely at the ankle joint(s): group1: left and right foot, group2: all the other bodies
* Create a virtual single body for each of the groups conserving physical properties.
* Create the Inverted Pendulum from those 2 virtual bodies.
* Do the control task with the IP, resulting in differnt target state for the upper body
* Rotate the upper group of ragdoll bodies to reflect the changed state, use IK solvers to compensate errors introduced from that simplification.

OK!

Firstly, Blender uses Bullet and can't use any other physics library.

Secondly, I kind of get the idea how to do it, my real problem is - how to calculate, how strong torque is needed at specific body part(aswell as it's direction) to keep it balanced. I could even figure out the torques if I knew the mouscle stretching factors...

Secondly, I kind of get the idea how to do it, my real problem is - how to calculate, how strong torque is needed at specific body part(aswell as it's direction) to keep it balanced. I could even figure out the torques if I knew the mouscle stretching factors...


If i get the question right, you need to solve the control problem first for a target pose and then use a constraint solver to calculate torques to get that pose.
... so you have to solve the hardest problems first without any way to proove what's wrong.

A better approach would be to ignore the control problem and focus on simultion only.
The goal would be to have the ragdoll keeping it's default T-pose (or any pose e.g. from animation).
It may fall over, you may pick a limb and drag it around, but it should keep the pose.

I assume you use Bullets standart ball socket joints to keep the bones at their joint positions, so you only need to worry about torques.
With Newton i can set a relative target acceleration for each joint and it solves the multi body problem for me.
If Bullet has no rotational motorized joints (i'd ask at bullet forum), you need to make your own constraint solver.
(I can't tell how - i have an idea but don't know how well it would work)

1. Physics simulation:
Imagine a human standing on only one leg. That's a system of 20 bodies and the foot body and ankle joint has to carry all the weight.
Mass ratio here is 1:50, worst case for game physics libs. Bullet can't even simulate a stack of a few equal mass bodies without jitter (the last time i've checked),
and also it may miss the necessary features for powered joints. So it's not the best choice for a demanding simulation like this and you'll have to add a lot of work,
probably ending up doing your own constraint solver.
I have experience with Bullet, Havok and ODE, but when i tried Newton i was blown away by the difference in stability, accuracy and robustness it offers.
It's by far the best library for this kind of simulation - sadly only few people know about this.


If you want accurate, stable control of a mechanism with lots of joints and large mass ratios, the important thing is to be using an appropriate solver. Bullet does have a Featherstone solver, though I don't know how good it is for actively driving articulations. PhysX has an articulation solver, and I know from first hand experience that it can be used to drive articulations accurately, without excessive numbers of iterations/small timesteps.

* Cheat and use external forces to stabilize the system :)
(I assume Natural Motion does this, but that's just an assumption)


Your assumption is wrong :) Of course, we can use external "cheat" forces to add stability, but that's not the fundamental method (and it all works without this). I can't discuss the methods by which we calculate the joint torques, but the character is controlled by joint torques.

For example, there's some nice demo here:

You want to know masses and moments of inertia for the different body parts, and don't want to go to the messy trouble of chopping up a cadaver yourself? OK - take a look here: http://www.smf.org/docs/articles/hic/USAARL_88-5.pdf

Ooops, sorry for the wrong assumption (still having a copy of jiglib around as an appologize) :)

To complete the updated information about physics engines, Newton has a new feature for accurate joint graphs as well.
I'll try it when i have time to come back on this...

Thanks for the pdf :)

This topic is closed to new replies.

Advertisement