Hi everybody :),
I am trying to copy bone rotations to a cube through a python script. Because the constraints from the “Object Constraints” panel doesn’t work in the BGE.
I have written a little script, but it doesn’t work. Maybe the syntax is not correct. Or maybe it’s not possible to copy rotations from a bone to an object. The Bone from armature ist animated through an animtion (which is trigged through the actuator logic brick “Action”)
And it works almost: the only trouble ist that spatial coordinates reference (xyz axis) from the bone don’t match with spatial coordinates reference (xyz axis) from the cube; so that the cube is moving left/right when the bone is going up and down.
Again my updated blend file, if you want to have a quick look test6.blend (503 KB)
To begin with, I’ve next to no idea how matrices work :no: I’ve yet progress much so I can’t really help you much when it comes to mathematics but try this
Hi Guramarx,
it is better. Thank you for your help. I know much less than you about python scripting so don’t worry :D.
I thought actually that the cube was copying right the movement of the bone, but at least it’s not the case. I have weight parented a mesh to the bone to make bone’s movements visible. And as we can see on this video capture it doesn’t match completly unfortunatly:
[video]https://youtu.be/b7rcrwMDlnc[/video]
The blend file can be download here test8.blend (529 KB)
@@BluePrintRandom, it works! I tried that method earlier but gave up and was wondering why it didn’t work, and it turns out I was parenting with “object/armature deform” to the bone and that kept everything from working lol, Thanks for the tips
@@sunyx instruction above and parent the empty to the armature with CTRL+P and “Bone” selected, the rest is just changing your code
This thead was helpful to me, so I wanted to jump in and give my answer/fix.
Unfortunately, parenting objects to Bones in the BGE can cause issues with armature animated meshes. Especially when Blending animations via script. I have worked out a fix to directly copy location and rotation of any bone in a scene: