sahil
sahil

Reputation: 1126

change bones position in a armature in blender game engine using python

I am working on real time mapping of model with the user data obtained from Kinect. I am able to get access to the individual bone using bge.types.BL_ArmatureObject().channels which give the list of bones. I am not able to change the position bone. I tried to use rotation_euler to give it some rotation but it had no effect. Please tell me how to do it.

Upvotes: 1

Views: 5443

Answers (1)

Florian
Florian

Reputation: 31

Maybe a little late, but for blender >= 2.5 this should do the trick:

# Get the whole bge scene
scene = bge.logic.getCurrentScene()
# Helper vars for convenience
source = scene.objects

# Get the whole Armature
main_arm = source.get('NAME OF YOUR ARMATURE')

main_arm.channels['NAME OF THE BONE YOU WANT TO ROTATE'].joint_rotation[ x, y ,z] # x,y,z = FLOAT VALUE

main_arm.update()

I also wrote this down in an extensive tutorial, starting here: http://www.warp1337.com/content/blender-robotics-part-1-introduction-and-modelling

Upvotes: 3

Related Questions