Hey guys,
I can’t make the scatter2D + check_for_collisions to work…
can you help me?
here is the code:
import omni.replicator.core as rep
camera = rep.create.camera(
rotation=(0, -90, 0),
position=(0, 0, 100)
)
render_product = rep.create.render_product(camera, (1920, 1080))
plane = rep.create.plane(
scale=(25, 60, 1),
visible = True,
)
usd_create = rep.create.sphere(scale=(5,5,5), count=10)
# usd_create = rep.create.from_usd('omniverse://localhost/Users/johnson/spheres/GreySphere.usd', count=10)
with usd_create:
rep.randomizer.scatter_2d(
surface_prims = plane,
check_for_collisions = True
)
def dome_lights():
lights = rep.create.light(
light_type="Dome",
rotation= (270,0,0),
texture=rep.distribution.choice([
'omniverse://localhost/NVIDIA/Assets/Skies/Cloudy/champagne_castle_1_4k.hdr',
'omniverse://localhost/NVIDIA/Assets/Skies/Clear/evening_road_01_4k.hdr',
'omniverse://localhost/NVIDIA/Assets/Skies/Clear/mealie_road_4k.hdr',
'omniverse://localhost/NVIDIA/Assets/Skies/Clear/qwantani_4k.hdr'
])
)
return lights.node
rep.randomizer.register(dome_lights)
# rep.randomizer.register(refSpheres)
with rep.trigger.on_frame(interval=1):
rep.randomizer.dome_lights()
with usd_create:
rep.randomizer.scatter_2d(plane)
# rep.randomizer.refSpheres(8)
# Initialize and attach writer
writer = rep.WriterRegistry.get("BasicWriter")
writer.initialize(output_dir="_output_camera_uniformpos", rgb=True, bounding_box_2d_tight=True)
writer.attach([render_product])```