Python Bone copy orientation

I have a question how can i copy orientation from object to bone of the armature?

can someone help me?

I am looking for a solution of this, too.

In the attachment you find a sample .blend of what I am trying to do: I want to copy the position and rotation of an object to a bone.
There are still some problems with the orientation, would be great if anybody got an idea how to fix that.
I tried to switch the axis, but with that I get really strange results when I rotate around both axis.

Use WASD to move the object, arrow keys to rotate it.

Another solution that would work for me, wouly be to use something like “track to” on the bone in combination with a second object (target). But I could only use this on a armature, not with a single bone, and I don’t think that I can use several armatures on the same mesh.



boneBGE.blend (166 KB)

Check this thread:

Yes, that is where I got the basic setup using setChannel(). But the sample covers position only, no orientation. And that is where I am stuck. :-/

Thanks to david_h72, I could get it work correctly and built a small sample file.
Maybe it will be helpfull for others who encounter the same problem. :slight_smile:

edit: it’s for 2.49


boneBGE_sample.blend (176 KB)

Matrix.toQuat() good solution :slight_smile:

thanks mates.

Hi again,

I made a little update for this sample. Now it does work very well with offsets of the dummy objects, too!
Hopefully the documentation helps. Feel free to ask if you are stuck with something.



boneBGE_sample3.blend (186 KB)

Hey is there a way to make this into a realtime GE ragdoll?

Already working on it :smiley:

And real time bone control (armature bones following objects)

And another discussion

how to alter the script from 2.49 to 2.57?