0
\$\begingroup\$

So I want to make automatic ragdoll generation system for all my enemies in my game, the assets are already made and have been paid for a while ago so I can't really ask the artist to change anything or generate some extra info, they are a variety of models (humans, robots, beasts) with a hard limit of 32 bones. Each bone is labelled and there is only a single mesh provided, which is skinned and ready to go.

I am trying to understand how an automated system can generate ragdolls from this. So far my idea involves convex decomposition (v-hacd?) to split up the mesh into small convex hulls and attach them using hinge and cone twist constrains (in bullet physics).

The idea sounds simple in my head but actually there are so many questions such as, how to do it automatically? how to make each convex hull be attached to a bone correctly? how to join the convex hulls with constraints in the correct place? the ragdoll would be generated from the bind pose, but how to transform the ragdoll so that it is perfectly aligned with the skeleton after its death animation?

I would very much appreciate some guidance on this, thanks.

\$\endgroup\$
1
\$\begingroup\$

If you make a convex hull that just means you are splitting up your existing geometry. So the binding to the bones should stay exactly the same. If you do add in some verts to plug holes, you can just average it to neighbors or bind it directly to the nearest bone. I makes no sense to make a split near a joint so it shouldn't be an issue. If you DO split near a joint then you will have to make all the geometry of any new verts AND surrounding verts skinned only to the bone that you keep. Otherwise you will have the detached bones influencing motion.

Now as far as why you need this...I am a little unclear. You shouldn't need to split the mesh up just to make ragdolls, you only need that for things like making an object explode into pieces. So I am guessing that you also want some ability like that as well. If you are going to have things like limbs blown off then I suggest to just have this done in the middle of a large bone and then split off the skeleton in code.

That should be theoretically easy, just take a particular node for the split and make everything that's a child of it part of the new skeleton. You should be able to run all the same animations if you want.

As for keeping the ragdoll from being too loose, just place some constraints on the motion. I would just do it manually for each joint because some joints can move a lot in some directions but very little in others or else it will look awful. You really only need some subtle motion for the most part, just enough to give the illusion of reactivity if you slam a dying enemy into the wall or throw him off of a cliff.

Going into the physics itself is probably too much for a post like this and I am not a big expert anyway but that should be sort of automatic once the physics engine gets your data. Hopefully this is enough to at least get you started, sometimes brainstorming is the hardest part!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.