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

12 December 2009, 12:25 PM
vector $pos =particleShape1.position;
float $posY = ($pos.x)*($pos.x) + ($pos.z)*($pos.z);
particleShape1.position = <<$pos.x, $posY, $pos.z>>;

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 December 2009, 05: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.

12 December 2009, 12:41 AM
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.


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