Spawning rigid bodies for rendering

Hi there,

I’ve got an animation where I’d like to fire a stream of rigid bodies from a point, so that they drop to the ground and bounce about. I’ve got this working in the game engine by creating an Add Object actuator in the logic screen and creating a controller powered by this script:

import bge

scene = bge.logic.getCurrentScene()
spawn_target = scene.objects["SpawnTarget"] # a Null where objects are spawned
cont = bge.logic.getCurrentController()
spawner = cont.actuators["Spawn"] # the actuator
spawner.object = "Ronson" # the object to duplicate
obj = spawn_actuator.objectLastCreated
obj.worldPosition = spawn_target.worldPosition

Works great in the game engine. If I try to record this animation so I can render it, the result is that it just shows the original object firing from the SpawnTarget then vanishing and reappearing back at the SpawnTarget each time a new one is fired. I guess this is because it’s not really creating new objects in the scene with new IDs, so it’s re-recording the same one object. I will have a play at getting it to generate objects with unique IDs. I’m not sure if the scene supports adding objects midway through an animation so that also might cause problems.

Just wondering if anyone had already tackled this?