setting Bone constraints in Engine?

For all that are familiar with logic bricks, you can set their attributes to different values via python. Can you do the same for Bones with their constraints?

I’m asking this because in order to make a ragdoll, you must use bone constraints to make each bone copy the transforms of their corresponding rigid bodies. But my question is, how do I “set up” the bone constraints after having spawned all the ragdoll components? Wont all the armatures of each newly spawned ragdoll just copy the transforms of the first set of rigid bodies that was spawned? Or will the armatures automatically know to copy the transforms of the ragdoll system that it spawned with?

you can edit physics constraints with python

but I have not tried armature constraints,
I will take a look at it tonight

So now I found how to access individual bone constraints by first import bpy at the top of my script. It looks like the “target” property for the bone constraints is found here: bpy.data.objects[“Armature”].pose.bones[“Bone.011”].constraints[“Copy Transforms”].target

But I’m having trouble setting the “target” to a new object. When I try setting it as “OBexampleObject”, it says “expected an Object type, not a str”

and when I try setting it to an already defined gameObject, it says “expected an Object type, not KX_GameObject”.

What seems to be the problem?

it appears that I have found a legit way of doing this. Instead of accessing the constraints through bpy. All the constraints are accessible via “exampleGameObject.constraints”.

So if I want to change the target of a copyTransforms constraint. I can do this like so "own.constraints[“ExampleBone.011:Copy Transforms”].target = “NewTarget.001” "

yeah, until they fix group instance spawning, you will need this
code to spawn a group instanced ragdoll,
add armature and skin add ragdoll, target armature bones to copy rot from ragbones.

Correction: Yes, you can assign the bone constraint targets via python however, it still doesn’t work when the armature is added from an inactive layer. I printed out the “target” value for the bone constraints and it does indeed look like they are referencing the correct newly instantiated rigid bodies. But instead the armature still appears static and in its default pose…Is there any way around this? Has anyone else made a fully skinned ragdoll that can be spawned at will? Or is this where I need to get to work?

Smack it with a action for 1 frame :smiley:

Omg that worked!!! BluePrintRandom…you’re beautiful…and don’t ever let ANYONE tell you otherwise!!!

I think it’s not on the ‘Threaded action list’ until you pop it on there or something like that,

not sure though :smiley: