randomizing fields using completly random values?(like world position?)

   1698   2   1
User Avatar
Member
30 posts
Joined: Jan. 2012
Offline
Hi guys
question for you

i am making a tool to generate a specific type of assets in clusters, and i would like to be able to randomize certain fields in those assets(like for instance, randomizing the offset in a mountain sop) but not based on points or number of points, or anything related to those assets in specific since im using a copy-sop all the copies have similar stats. How can i get completly random values for those? I was thinking about using the world position of where they are created to use for the rand() but i have no idea on how to do that. Please help

thanks
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
Incorporate world position in to point position for random seed generator…

One way is to promote a vector parmeter and use the vorigin() or more specificialy vtorigin() hscript expression to crack the world transform to this parent object.

tx: vtorigin(“”, “../”)
ty: vtorigin(“”, “../”)
tz: vtorigin(“”, “../”)

where “” is world space and “../” is my parent's position or my object container in this case.

The trick is knowing that vtorigin() returns a vector and you can use the square brackets to index in to the result of the vector counting from 0.

You can also use vorigin which returns an array of 6 elements tx-tz and rx-rz where you use to to fetch the translates and rotates for even more randomability.

See the example file along with the same notes above as a comment in SOPs beside the Attribute VOP.

Attachments:
vtorigin_for_random_numbers.hip (110.0 KB)

There's at least one school like the old school!
User Avatar
Member
30 posts
Joined: Jan. 2012
Offline
thank you Jeff
  • Quick Links