Random rotation of several objects

Dear people,

I have a peculiar riddle for you. What am I trying to achieve: I want to populate the site in the rhino file with trees, and to give it a bit of flair, I would like to randomly rotate each tree and meshes that forms the foliage. I managed to get quite far, but there is a problem in data matching I am not able to crack, since every mesh rotates along the axis of every other mesh and not only along its own axis.

Do you idea how could this be done? either by manipulating the data or maybe rotating the mesh with other means.

Have a great day!

Ondrej

RANDOM ROTATION.gh (8.8 KB)
20190321_SIte.3dm (276.8 KB)

hi @o.s,
this is the simplest way i can think of to achieve rotation around the center axis for each individual mesh, but there is nothing in your script for population of the site, how are you planning on doing that?

Also is it crucial that every tree has the foliage rotated slightly different or would it be sufficient to have the trees distributed on the site and rotatated differently as a whole?

RANDOM ROTATION.gh (10.4 KB)

1 Like

Thank you Lando, much obliged, that was exactly what I needed. Did not know about that centroid part of volume function.
The populating of the site was not the issue, the positions of the trees are known, I just wanted randomization of the trees to apear more natural. Now I can select all the meshes at once when I will place the trees corretly and rotate them with your improvement and not every one separately, you are awesome!