Hello,
I am using Replicator for randomizing the positions of items in a scene. I want to modify the positions such that the items move about their own local axis (i.e. they translate locally rather than globally). My current code looks like this:
import omni.replicator.core as rep
import random
seed = random.randint(545631, 1000000)
rep.set_global_seed(seed)
with rep.new_layer():
camera = rep.create.render_product(
"/Camera",
resolution=(1920, 1080)
)
def item_randomizer():
items = rep.get.prims(path_pattern='items', prim_types=['Xform'])
with items:
rep.modify.pose(
position_x = rep.distribution.uniform(-30, 30),
)
rep.randomizer.register(item_randomizer)
with rep.trigger.on_frame(num_frames=10):
rep.randomizer.item_randomizer()
basic_writer = rep.WriterRegistry.get("BasicWriter")
basic_writer.initialize(
output_dir="_Output",
rgb=True,
)
basic_writer.attach([camera])
rep.orchestrator.run()
The command rep.modify.pose(position_x = rep.distribution.uniform(-30, 30),) moves all the items randomly to a global position between -30 and 30. What I want to do is that the items translate about their own current position by certain millimeters. I have searched far and wide but have not been able to find a solution for this. I would appreciate some insight on this topic.