Jump to content
Sign in to follow this  
ela1995

random transform with for each loop

Recommended Posts

I have a an object that I cut into pieces with grid. For each pieces, i want to move them randomly within x and z direction. But when I write the @P in Wrangle SOP, it only move the point within that piece. I want to move the whole piece not just a point, how do i do that

randomTransForeach.hipnc

Share this post


Link to post
Share on other sites
Posted (edited)

rand(0.5234 + detail("../foreach_begin1_metadata1","iteration",0))

How do you set the values it produce inbetween two values. Let's say between -40 & 40

With this "For-Each connected Piece" all the objects get the same rotation/translate values, I tried to fix it but still no luck.

I spent hours trying to figure it out!

Thx

Edited by klawchi

Share this post


Link to post
Share on other sites

The rand() function produces a value between 0-1. Knowing this, to set a range, simply use:
[range_start] + rand([seed]) * [range]

In your example, this would be:
-40 + rand(seed) * 80

Make sure your For Loop is running over the correct geometry type (Points/Prims/Count).

Share this post


Link to post
Share on other sites
11 minutes ago, Fenolis said:

The rand() function produces a value between 0-1. Knowing this, to set a range, simply use:
[range_start] + rand([seed]) * [range]

In your example, this would be:
-40 + rand(seed) * 80

Make sure your For Loop is running over the correct geometry type (Points/Prims/Count).

Thank you so much.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×