PDA

View Full Version : could you explain methe difference between this 2 scripts


flore33
12-04-2009, 11:25 AM
script1
vector $pos =particleShape1.position;
float $posY = ($pos.x)*($pos.x) + ($pos.z)*($pos.z);
particleShape1.position = <<$pos.x, $posY, $pos.z>>;

script2
vector $pos =particleShape1.position;
float $posX=$pos.x;
float $posY=$pos.y;
float $posZ=$pos.z;
float $posY = ($pos.x)*($pos.x) + ($pos.z)*($pos.z);
$pos = <<$pos.x, $posY, $pos.z>>;

this 2 scripts don't return the same particle motion, but I don't get why, I can see from this testing that
vector $pos =particleShape1.position; is different from
particleShape1.position =vector $pos;

but I don't understand why. Could someone help me to understand the difference.
This will be very helpful. Thanks

Derek Wolfe
12-04-2009, 04:32 PM
the second expression gathers position from a particleShape, and then declares several variaables and assigns values to them. It does not assign a value back to the particleShape, and thus, has no effect on the particles final position.

Wick3dParticle
12-07-2009, 11:41 PM
Script 2 seems to be poorly written. $posY is being assigned twice, (float $posY=$pos.y) is irrelevant . And like Derek mentioned, it is not assigning a value back to the particle. It is basically just declaring values.

~Ilan

CGTalk Moderation
12-07-2009, 11:41 PM
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.