• Hey! Guest! The 37th GMC Jam will take place between May 28th, 12:00 UTC and June 1st, 12:00 UTC. Why not join in! Click here to find out more!

Ragdoll Physics



I've played the game Deadbolt and what i would like to do with my game is simulate the ragdoll physics the same way. The logic i've seen in the game is as follows (Please correct me if i'm wrong somewhere)

-Enemies move with physics turned off.
-When you shoot them and your bullets collide with them, they are highlighted but they keep the same sprite, no animation.
-Bullets collide and their health is now 0 (Death).
-Now there is no animation when they die, physics is enabled in a "Death event" and their bodies just fall apart after interacting with the bullets. (This is all simulated with the physics GM box2d).
-Now comes the difficult part. Every leg, arm, and head is defined as a separate object and inserted in a specific position so that all of the objects form the body and the difference is imposible to distinguish. These objects have physics turned on and they have joints. And this is what makes the ragdoll work.

Do you think this logic is correct? Well i tried to do this by following these steps, with stick figures, but something crazy happened. When the objects were inserted (2 legs, 2 knees, 2 arms, 2 forearms, 1 chest and 1 head) with their joints, when colliding with walls or other objects they started spinning infinitively and accelerating to the point of game crashing.
I tested this with small stick figures, 1 or 2 pixels of thickness. Do you think the joints could have been set up at a incorrect points?

Sorry for this lenghy explanation! :)