zollfnn
November 14, 2023, 2:01pm
1
Hi,
I want to randomize the count of cubes with every trigger. The distribution function dosen’t work with count. Also I tried instantiate, but I cant figure out how to use it with shapes created in the script, only with exsting scence…
Kind Regards
@zollfnn i recall one option is to toggle their visibility:
If I understand what you are trying to randomize correctly, something like this should work:
import omni.replicator.core as rep
NUM_SPAWN = 4
with rep.new_layer():
l_plane = rep.create.plane(scale=10, position=(-500, 0, 0), visible=False)
r_plane = rep.create.plane(scale=10, position=(500, 0, 0), visible=False)
spheres_l = rep.create.sphere(count=NUM_SPAWN, semantics=[('class', 'sphere'), ('side', 'left')])
cubes_l = rep.create.cube(count=NUM_SPAWN, semantics=[('class', 'cube…
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():
c…
zollfnn
November 16, 2023, 8:44am
3
@Simplychenable Works great, thank you very much!
2 Likes