Itoo Software Forum

Author Topic: Random Transform, Random less then 1.0 value.  (Read 1126 times)

allemyr

  • Newbie
  • *
  • Posts: 19
Random Transform, Random less then 1.0 value.
« 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!

Rokas

  • Hero Member
  • *****
  • Posts: 3324
Re: Random Transform, Random less then 1.0 value.
« Reply #1 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));
Rokas

allemyr

  • Newbie
  • *
  • Posts: 19
Re: Random Transform, Random less then 1.0 value.
« Reply #2 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?

Rokas

  • Hero Member
  • *****
  • Posts: 3324
Re: Random Transform, Random less then 1.0 value.
« Reply #3 on: March 25, 2020, 05:00:43 PM »
You can use already existing effects for that:
Rokas

allemyr

  • Newbie
  • *
  • Posts: 19
Re: Random Transform, Random less then 1.0 value.
« Reply #4 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.

Rokas

  • Hero Member
  • *****
  • Posts: 3324
Re: Random Transform, Random less then 1.0 value.
« Reply #5 on: April 23, 2020, 03:14:55 PM »
Hi

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



Hope this helps.
Rokas

allemyr

  • Newbie
  • *
  • Posts: 19
Re: Random Transform, Random less then 1.0 value.
« Reply #6 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?

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 2991
Re: Random Transform, Random less then 1.0 value.
« Reply #7 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
Paul Roberts
iToo Software

allemyr

  • Newbie
  • *
  • Posts: 19
Re: Random Transform, Random less then 1.0 value.
« Reply #8 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!

Rokas

  • Hero Member
  • *****
  • Posts: 3324
Re: Random Transform, Random less then 1.0 value.
« Reply #9 on: November 06, 2020, 10:49:43 AM »
Compiler stops at unidentified variable. You need to define it first:
Rokas