2 questions - explosion and angular velocity

1. How could I make a fast explosion with Box2D?
2. How can I make the angular velocity solving faster/more precise?
Now the angular velocity setting to angle_error (best_angle-body->GetAngle()) for my body but it swings like a pendulum..
How can I fix this?
I need it to be very precise because the body is The body of my ragdoll which has other bodies connected to it so when I animate them, the main body swings too! I can't let that happen.. 🙁
1. Explosions are somewhat easy to do in box2d. Use b2World.Query to get a list of bodies near the blast, and then apply an impulse to them / add to their velocity according to their distance from the blast. See this post, which I found from the wiki programming FAQ.

2. I presume this is in response to your question about setting ragdoll joints. I cannot think why you'd see it swinging like a pendulum rather than converging to the correct position. Are you sure you are setting the velocity, rather than adding to it? Or possibly try using a smaller scaling factor? It is not that suprising that you are causing the main body to swing with this method, as you are putting energy into the system by setting the velocity.

If that adaptive method isn't working out to your tastes, you could try Forward Kinematics to set the joints instead. You'll have to decide if the extra work, and the loss of physics like behaviour, is worth it.
Ok about that explosion, thanks!
First I used inverse kinematics, last night I changed some of the code and now Forward kinematics is used!
Everything works ok, joint angles are changed with the motor correctly!
But the ragdoll as whole swings even if I set the linear velocity to error angle for the main body..
I am sure I only set the angular velocity, but I thought maybe ApplyTorque() could help me..
If I set the scale factor to smaller one, it doesn't stop the natural swinging and moves the body too slowly..
Hmm, I'm not sure I understand. Perhaps some sample code, or a gif of the problem?
I have something better:
http://foto.inbox.lv/snake5/2d-shooter-game/ang-vel.wmv
Maybe this will help 🙂
I'm not certain what I'm seeing there, but it seems to be working fantastically. I do see a bit of wobble of the entire doll gobally (i don't think it is accurate any more to call it a ragdoll), but it looks like exactly what you'd expect for a person flailing their limbs like that.

If it's annoying you, set the torso's moment of inertia higher, so it can swing the limbs with relatively little effect.
alright, I'll try changing that!
ok, it worked a bit, thanks!

so now the problem is - why does the body get to the correct position so slowly?
Still not sure I've understood here. I see the body doing a sumersault slowly, but I thought that was because it's joint was being slowly changed (the third parameter)? I also see it wobble a bit when you try to completely stop it, which is wrong now I think about it. Are you sure you are treating the joint between the ground and the torso the same as the joints between the torso and limbs? And is that really what you want to do anyway (usually these dolls are free to move around)?
I don't have any joint between ground and torso, I just set the linear velocity..
the wobbling is what I don't need, I can't remove it completely and I don't know which setting controls how much the joint is solved each time step..
Well, you are trying to control the overall rotation of the doll the same way as you are trying to set the individual limbs, so I suggest you use the same setup for both.

Original thread: https://box2d.org/forum/viewtopic.php?t=601