PDA

View Full Version : Two equal goal objects


H3ro
02-22-2006, 12:01 PM
I have two objects that need to have the exact same goal values.

For goalV i have a ramp.
And for goalU i have this script:

//input
float $changeR =frame ;
float $min =0 ;
float $max =1 ;

//script body
seed($changeR);
float $a = rand($min,$max);

particleShape1.goalU = $a;

when i try to play this, i get a really bad looking simulation. I need both of the object to have the same random U value at the same time. Any ideas?

coccosoids
02-22-2006, 05:51 PM
this is straight out from the maya help docs :)

A common mistake while using the seed function follows:

seed(1);
Ball.translateX = rand(5);

H3ro
02-23-2006, 12:22 AM
So, I need to have the if function at the start?

-------

//input
float $changeR =frame ;
float $min =0 ;
float $max =1 ;

//script body
seed($changeR);
if (frame ==1)
float $a = rand($min,$max);

particleShape1.goalU = $a;

coccosoids
02-23-2006, 07:11 AM
i can't quite understand the effect you're after but i don't think that the seed function is meant to be controlled that way...
i think each time you're expression executes the seed function gets called...so on frame 1 you get seed = x ...then the random function...on frame 2 you get again the seed + the random so i guess you only get the first value from the random stream...
you have to set it with an if statement like :

if ( frame == 1 ) seed (n);

CGTalk Moderation
02-23-2006, 07:11 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.