how to copy objects with gamepython

hi,

is it possible to create copies from GameObjects similar to


destObj = srcObj.copy()
actScene.link(destObj)
destObj.setLocation(…somewhere…)

in the normal Blender-Python API?

A workaround with a fixed number of premade, disabled copies is not suitable, because I’ve no clue how many objects the user will need.

Thanks in advance,

Ferdinand

what are you trying to do?

somehow I don’t see the add object actuator as not fufiling your needs, you can add as many as you want (just one per frame)

Thanks for the tip, I tried that, but… is this Actuator doing anything - or am I simply too stupid to use it…

I stripped a key-sensor (an AND-Controller) and an “Edit-Object” actuator together, set the actuator to “Add Object”-Mode, filled in the Object I want to copy (the same one that’s linked to the controller) and gave it a initial speed-vector. What happens when I press the specified key is - simply nothing. (All other modes like “End Object” and “replace Mesh” work as expected)

Am I doing something wrong?

Thanks,

Ferdinand

P.S.: Also tried to change the time value to 2000. Doesn’t help at all.

the object needs to be in a layer that isn’t visible when the game is running, otherwise the add object actuator will not work.
(it complains in the console window too)

if the time value is 0 the object will not die after a period of time, but you can kill it with the edit object->end object actuator.

reading the manual is sometimes of advantage :expressionless:

it’s working now, thanks

dF