I tryipcally make a ragdoll with ridid body joints, make sure there rotations match up with the bone they are mimicing in the orignal armature and then target that with armature copy rotation constraints in the ragdoll armature.
- make a group of the ragdoll with it’s origin at 0,0,0 on a hidden layer.
add a instance of the group (this is what you will be adding to the scene later is the instance)
to make the pose match the death pose of the agent is also tricky
I parent a emtpy to each bone that will be limp and give it a property
BoneCopy that is a string - which is the name of the ragdoll bone that will match it.
in the enemy have
if heatlth <=0: --------------python
own = bge.logic.getCurrentController.owner
added = own.scene.addObject( 'RagDollGroupInstanceName', own, time)
for child in own.childrenRecursive:
if 'BoneCopy' in child:
for member in added.groupMembers:
if member.name == child['BoneCopy']:
member.worldTransorm = child.worldTransform