0
$\begingroup$

In Blender I can move the pose of an object using:

bpy.data.objects["Rig"].pose.bones["Bone"].location[0] += 0.1

In fact, if I execute this code in the game engine, it does nothing in the game engine, but when I come back to blender the object's pose has moved as expected.

How do I achieve the same thing in the game engine? I want to move some eyes based on a simple keyboard input.

Update:

I have found that I can access, but not update, this value in the game engine with:

import bge
channel = bge.logic.getCurrentController().owner.channels["Bone"]
print(channel.location)

Console output:
<Vector (1.1683, -0.0078, 0.0000)>

Trying to update that value with channel.location.x += 0.1 does nothing in-game though.

$\endgroup$

1 Answer 1

0
$\begingroup$

I was missing an update call: armature.update()

More precisely, bge.logic.getCurrentController().owner.update() needs to be called after any updates to the armature in order for it to update in the game engine.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .