Below is a sample code of what I’m trying to achieve. Basically I first scatter a box asset on a plane, then I wanted to execute CODE1 or CODE2 depending on a random value given by the variable with the same name.
The box asset moves to 10 different positions as expected, but random value is only affected once and never changes, which means it only executes either CODE1 or CODE2, but never both of them as I wanted. I have tried with an higher number of frames just to make sure it’s not pure coincidence that the random value is always the same. I’ve tried printing random value and it only prints a number once, instead of printing an amount of numbers equal to the number of frames.
What am I doing wrong?
# Number of frames to randomize
with rep.trigger.on_frame(num_frames=10):
rep.randomizer.scatter_asset(box, plane)
# Generate a new random value
random_value = random.randint(0, 1)
if random_value == 0:
# do CODE1
elif random_value == 1:
# do CODE2