Scatter 2d on a plane with a slope (or on any round mesh)

Isaac Sim Version

4.2.0

Operating System

Windows 10

GPU Information

  • Model: RTX 4090
  • Driver Version:

Topic Description

How can I scatter objects on a plane with a slope?
I’m following this tutorial: Scatter Examples — Omniverse Extensions

If I replace spheres with cubes and change the count to 1:

The expected results I am hoping to get should look something like this:

Steps to Reproduce

  1. copy and paste this code in the Script Editor window:
import omni.graph.core as og
import omni.replicator.core as rep

# create a plane to sample on
plane_samp = rep.create.plane(scale=4, rotation=(20, 0, 0))


def randomize_cubes():
    # create small spheres to sample inside the plane
    cubes = rep.create.cube(scale=0.2, count=1)

    # randomize
    with cubes:
        rep.randomizer.scatter_2d(plane_samp)
        # Add color to small spheres
        rep.randomizer.color(colors=rep.distribution.uniform((0.2, 0.2, 0.2), (1, 1, 1)))
    return cubes.node


rep.randomizer.register(randomize_cubes)

with rep.trigger.on_frame(num_frames=1):
    rep.randomizer.randomize_cubes()
  1. inspect the result and notice that we are not getting expected results of a cube scattered on a plane.

How can I solve this issue?

Thank you

Another example:

import omni.replicator.core as rep
spheres = rep.create.cube(count=100)
surface_prim = rep.create.torus(scale=20, visible=True)
with spheres:
    rep.randomizer.scatter_2d(surface_prim)