Hello @lily.chen,
Replicator doesn’t come with a node to destroy prims, but you can easily (and with more performance) accomplish your goal using visibility toggling:
import omni.replicator.core as rep
rep.settings.set_stage_meters_per_unit(1)
def randomize_spheres():
spheres = rep.create.sphere(
position= rep.distribution.uniform((0,0,0), (2, 2, 2)),
scale=0.1,
count=2)
return spheres.node
rep.randomizer.register(randomize_spheres)
def randomize_cube():
cube = rep.create.cube(
position= rep.distribution.uniform((0,0,0), (2, 2, 2)),
scale=0.1,
count=2)
return cube.node
rep.randomizer.register(randomize_cube)
with rep.trigger.on_time(max_execs=2, interval=5):
spheres = rep.randomizer.randomize_spheres()
cubes = rep.randomizer.randomize_cube()
# Toggle visibility
with spheres:
rep.modify.visibility(rep.distribution.sequence([True, False]))
with cubes:
rep.modify.visibility(rep.distribution.sequence([False, True]))import omni.replicator.core as rep