Itoo Software Forum

Author Topic: random left and right  (Read 2000 times)

themaxxer

  • Newbie
  • *
  • Posts: 7
random left and right
« on: May 06, 2017, 07:12:51 PM »
hello

I try to make curtains that are randomly left and right in different widths... http://c2n.me/3KbJG8o.png

I know I need to tell railclone to put the curtain sometimes left and sometimes right and then add the random width, but how? :)

thanks in advance
themaxxer

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 2991
Re: random left and right
« Reply #1 on: May 08, 2017, 12:54:13 PM »
Hi,

Thanks for contacting us.

To do this you can use a random number node and the Selector operator. Basically you need to create two states: one where the curtain is on the left, one where it is on the right. To randomly generate these states you can use the Random Number node with a Minimum value of 1 and a Maximum of 2, set to generate a new value for each spline.



This is wired to a Selector operator's Index property. In the first input you would add your curtains and in the second, an empty "null" segment. When the random number returns 1 you'll get a curtain, when it returns 2 you get nothing. Wire this to the Start input.

Then duplicate the Selector operator and swap the inputs so that the null segment is now in slot 1. Wire this to the End input. Now whenever 1 is returned you'll get a curtain on the left and a null on the right. And when 2 is returned you'll get a null on the left and a curtain on the right.




I've attached a sample setup. I hope that helps, please let me know if you have any further questions.

Many Thanks,

Paul
Paul Roberts
iToo Software

Pierre

  • Full Member
  • ***
  • Posts: 108
    • Studiosezz
Re: random left and right
« Reply #2 on: January 04, 2022, 11:58:32 AM »
Hello,
I allow myself to reopen this old post that I tried to modify. I want the length of the segment to be between 1 and the maximum length of the spline. I modified the random parameters in this way but the length exceeds the maximum length of the spline. Can you explain to me why?
Regards
Pierre
Studiosezz PARIS
www.studiosezz.com

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 2991
Re: random left and right
« Reply #3 on: January 04, 2022, 01:01:33 PM »
Hi Pierre,

The X Size property always expects a value that is measured in scene units. This means you need to convert your percentage values into scene units by multiplying them with the length of each sub-spline. You can do this with an expression as shown in the screenshot below.



I've attached an amended version of the scene file.

I hope that helps,

Paul
Paul Roberts
iToo Software

Pierre

  • Full Member
  • ***
  • Posts: 108
    • Studiosezz
Re: random left and right
« Reply #4 on: January 04, 2022, 03:45:53 PM »
Thank you very much Paul, it helps me a lot; I I understood my mistake
Regards
Pierre

Studiosezz PARIS
www.studiosezz.com

BJ2494

  • Jr. Member
  • **
  • Posts: 55
Re: random left and right
« Reply #5 on: January 06, 2022, 03:23:40 PM »
please for 3dsmax 2017

Dragan

  • Hero Member
  • *****
  • Posts: 1419
Re: random left and right
« Reply #6 on: January 06, 2022, 03:31:02 PM »
.

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 2991
Re: random left and right
« Reply #7 on: January 06, 2022, 03:32:35 PM »
Thanks Dragan - saved me a job  :)
Paul Roberts
iToo Software