Itoo Software Forum

Forest Pack => Forest Pro (*) => Topic started by: allemyr on March 23, 2020, 07:29:11 PM

Title: Random Transform, Random less then 1.0 value.
Post by: allemyr on March 23, 2020, 07:29:11 PM
Hi Itoo.

I would like to ask if its powwible to random transform objects inside a Forest Pack object less then 1.0 value, like random rotate between -0.5 to 0.5 for example.
I can only write hole integeres but need something around 0.2 to 0.2 in rotation.

Thx in advance!
Title: Re: Random Transform, Random less then 1.0 value.
Post by: Rokas on March 23, 2020, 09:56:18 PM
You can use custom Effect.
This will ranzomize Z axis from -0.5 to 0.5 degrees:

fpItem.rotation.z = degtorad(randomReal(-0.5,0.5));
Title: Re: Random Transform, Random less then 1.0 value.
Post by: allemyr on March 25, 2020, 04:46:15 PM
Hi, Thank you very much works great!

What would the same be for translation in small amounts don't what to write instead of degtorad, value?
Title: Re: Random Transform, Random less then 1.0 value.
Post by: Rokas on March 25, 2020, 05:00:43 PM
You can use already existing effects for that:
(https://i.imgur.com/26R6aSZ.png)
Title: Re: Random Transform, Random less then 1.0 value.
Post by: allemyr on April 23, 2020, 02:11:27 PM
Hi, I would like to randomly translate items say 0.5 values in the Z direction how do I do that?

I'am working on a brickwall with Forest Pack right now, placing bricks in spline vertex positions.
Title: Re: Random Transform, Random less then 1.0 value.
Post by: Rokas on April 23, 2020, 03:14:55 PM
Hi

You can use "Translate in world units: effect and specify exact units in cm:

(https://i.imgur.com/cwWtcly.png)

Hope this helps.
Title: Re: Random Transform, Random less then 1.0 value.
Post by: allemyr on November 01, 2020, 08:01:51 PM
Hi again, thx for the repleis, helped a lot!

I also wonder If you on top of that can move random items 180 degrees to get more random bricks that I'am rendering right now. So a brick is rotated zero or 180 degrees in any axis, is that possible?
Title: Re: Random Transform, Random less then 1.0 value.
Post by: Paul Roberts on November 02, 2020, 09:16:24 AM
Hi, There is another built-in Forest Effect called Stepped rotation that should be able to do that for you. You can see a little more about it here: https://docs.itoosoft.com/forestpack/forest-plugin/effects/effects-examples/stepped-rotation

You can add as many Forest Effects as you need

Hope that helps,

Paul
Title: Re: Random Transform, Random less then 1.0 value.
Post by: allemyr on November 06, 2020, 10:35:45 AM
Ok cool! Thats nice, I found the premade effect. But I also want to add it in Y and X axis.

When I paste the expression in the expression box I get compile error.

I'am pasting this:

real rotateRange = fpItem.randRotMax.z - fpItem.randRotMin.z;
real stepsInRange = floor(rotateRange/Z_Rotate_Step);
real ZRotation = randomInt(0,stepsInRange)*Z_Rotate_Step;
fpItem.rotation.z = degtorad(ZRotation);

I want to rotate randomly in 180 degrees to get more variation off bricks in all axis. I'am also rotating all the bricks with a value of 0.5 in all axis aswell, will that be overridden by "Stepped rotation"?

Thx in advance :) Really appriciate it!
Title: Re: Random Transform, Random less then 1.0 value.
Post by: Rokas on November 06, 2020, 10:49:43 AM
Compiler stops at unidentified variable. You need to define it first:
(https://i.imgur.com/dESOYxc.png)