3dN00b
(3dN00b)
January 18, 2014, 7:36am
1
I have a group of empties that I would like to use as emitters. Each one should be used randomly. For that I have:
# limit amount that can spawn
if count < 10:
x = randint(1, 10)
ID = str(x)
emitterUsed = 'Emitter' + ID
# have emitterUsed spawn the object
Is something like this possible? If anything, I would like to avoid setting up 10 different messages.
olladitan
(olladitan)
January 18, 2014, 7:45am
2
scene = bge.logic.getCurrentScene()
emitted_object = scene.addObject('object_name', emitterUsed)
#I add this next line
emmited_object.worldPosition = emitterUsed.worldPosition
3dN00b
(3dN00b)
January 18, 2014, 8:44am
3
Thanks! Don’t don’t forget the other ‘m’ though in the first emmitted_object.
you don’t need the line
emmited_object.worldPosition = emitterUsed.worldPosition
with addObject, the added object automatically gets orientation and position from emitterUsed