How to modify an object's position withou affecting one axis

I’m wondering if it’s possible for Replicator to randomize a certain axis for an object within a class, while leaving one or two unchanged from the original position.

I tried this with 4 cones, placed them under the same class and placed them at different points on the z-axis. My goal is to randomize the x-axis, set the y-axis to a set point, and have the z-axis be unaffected by replicator, keeping the cones at the same points they originated.

Do I have to modify.attribute the x-axis? Setting the modifier to only one number affects all of the axis’. Here’s the code I have so far

import omni.replicator.core as rep

with rep.new_layer():
camera = rep.create.camera(position=(0, 300, 550), rotation=(-25, 0, 0), focal_length = 18.14756)
render_product = rep.create.render_product(camera, (1920, 1200))

cone1 = rep.create.cone(position=(0, 0, 0), semantics=[('class', 'cone')]
cone2 = rep.create.cone(position=(0, 20, -120), semantics=[('class', 'cone')]
cone3 = rep.create.cone(position=(0, 40, -240), semantics=[('class', 'cone')]
cone4 = rep.create.cone(position=(0, 60, -360), semantics=[('class', 'cone')]

def cone_move():
    with rep.get.prims(semantics=[('class', 'cone')]):
        rep.modify.pose(position = rep.distribution.uniform((-120, 0, null), (120, 0, null)))
rep.randomizer.register(cone_move)

with rep.trigger.on_frame(num_frames=10, rt_subframes=32):
    rep.randomizer.cone_move()
    
writer = rep.WriterRegistry.get("BasicWriter")
writer.initialize(
    output_dir="coneTest",
    rgb=True)
writer.attach([render_product])

Hello @jonathan.meitzler! I’ve shared your post with the dev team for further assistance.

Hi @jonathan.meitzler There isn’t currently a way to do this for a single axis, but, this feature is actively being worked on and will be in a future update.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.