When I call bpy.data.objects['Enemy'].game.actuators['<name>'].target = bpy.data.objects['XX'] the value is only updated after pressing Esc to quit game and then hitting P to start the game again.

How can I update the target in real time, without the need to stop and start the game again?


The bpy module does not work in the game engine, use the bge functions instead.

For instance:

objectList = bge.logic.getCurrentScene().objects
bge.logic.getCurrentController().actuators['<name>'].target = objectList['XX']

More information can be found on the bge.logic and bge.types pages of the blender python api.

  • $\begingroup$ It did not work. Unable to place the actuator seek. $\endgroup$ – Guilherme Mar 11 '14 at 5:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.