Don’t use bpy. The BGE uses different API from Blender. Get the object as usual (i.e. cont = logic.getCurrentController(), obj = cont.owner), but the object that you’re getting will be a BL_ArmatureObject, which inherits from KX_GameObject. It has the usual object properties, but also has a channels list that allows you to grab channels (or bones) to move about as necessary.
i=0
scene = bge.logic.getCurrentScene()
source = scene.objects
while(i<10):
main_arm = source.get(‘walk_turn_180’) #armature #bpy.context.scene.frame_set(i)
bpy.context.scene.frame_current = i ###here i used bpy, is there any simmilar function to change current frame in bge?
main_arm.channels[0].location = [float(1.0),float(i),float(1.0)] #root location
main_arm.update()
i = i + 1
i=0
while(i<10):
main_arm = source.get('walk_turn_180')
#bpy.context.scene.frame_set(i)
bpy.context.scene.frame_current = i
print(main_arm.channels[0].location)
i = i + 1
So, this code updates same value or last value for each frame. But I want to access bone for each animation frame and update location of root with different value. How can I access root bone location for each frame and update it?