GameEngine: adding actuator dinamically


I am using a script for adding objects from a database into a model. I need to add an actuator to each of these created objects. I have reviewed the API but I have not found an operation for adding and activating an actuator to a new object. Someone has done something similar?

Thank you very much!

I’m working on plug-in that allows to access data in logic bricks. I don’t have implemented modification/addition of objects yet, but I can add this funcionality later. What kind of actuator do you need to add?

Hello ashsid! I referred to motion actuators.



download blendGame plug-in and to create Motion actuator for current object use following script:

import Blender
import blendGame
obj = Blender.Object.GetSelected()[0]
gobj = blendGame.Object(obj)
act = blendGame.Actuator(gobj, 0, 'newAct')

when script runs (Alt-P) it will create new Motion actuator for selected object and gives it name ‘newAct’.

very nice! I keep thinking up ideas to use with that, but i think i must wait a bit and define them more ;(
great job though: thanks!

I have uploaded new version of blendGame plugin - more info there