I'm using the blender game engine, and I'd like to generate an object each time a key is pressed (i.e. press Space, and a rock will be loaded into a catapult)
My problem is that I am using this object within Morse, which currently doesn't support using hidden layers (everything seems to be put on the visible layer as soon as it is loaded)
Normally I would do something like this:
from bge import logic scene = logic.getCurrentScene() rock = scene.addObject("Rock", "Catapult")
Catapult is a mesh on one layer, and rock is a mesh on another. I would then use the logic bricks to make a keyboard actuator that calls this script. This works fine when I run it in Blender (currently using v2.6), but I get an error when running it with Morse:
ValueError: scene.addObject(object, other, time): KX_Scene (first argument): object must be in an inactive layer
Is there any way to generate objects without needing the inactive layer?
Alternatively, is there a way to programmatically move an object from an active layer to an inactive layer?