trancor
04-13-2008, 11:37 PM
Hey, I kinda realize this is a dynamic/mel issue rather than specifically mel. But I was wondering if I can set specific particle velocities from another particle's runtime.
Basically what I'm doing is just a test to see how far I can push the `rot` command and `cross` product command. So, everytime the (particleId % 3) == 0, I want to have the particle -2, -1, and particle 0 for the particleId, change velocities.
For clarity, lets say --
$id=particleId;
$x=$id-2;
$y=$id-1;
$z=$id;
So based off of the placement (pointPosition) of $x and $y, particle $z will find the vector between $x & $z -and - $y & $z and the cross product of those two vectors (being a perpendicular vector) will be taken on as the velocity on $z for the next frame before all of this math processes again.
(Each particle $x, $y, and $z, will go through this math for each of the other 2. basically forming a triangle plane in 3d space spinning around itself)
What I'm looking for is a way of assigning particle -2, particle -1, and particle 0 velocities all on one frame.
So is there some way of doing this --
particleShape1.pt[$x].velocity=$crossProdX;
particleShape1.pt[$y].velocity=$crossProdY;
particleShape1.velocity=$crossProdZ;
but with it working in mel.
I'm not really looking to make any extra per particle array attributes but, even if I had to make another attribute Per Particle on the particle system to maintain the vector arrays to be called on the next frame, sure, but how do I even set that
particleShape1.customVelocity[12]=$x math
particleShape1.customVelocity[13]=$y math
particleShape1.customVelocity[14]=$z math - CurrentFrame
I hope that was clear enough. I'm open to any suggestions if I should go about this another way. I'm just trying to get used to working with particles and runtime exps.
Thanks in advance
Basically what I'm doing is just a test to see how far I can push the `rot` command and `cross` product command. So, everytime the (particleId % 3) == 0, I want to have the particle -2, -1, and particle 0 for the particleId, change velocities.
For clarity, lets say --
$id=particleId;
$x=$id-2;
$y=$id-1;
$z=$id;
So based off of the placement (pointPosition) of $x and $y, particle $z will find the vector between $x & $z -and - $y & $z and the cross product of those two vectors (being a perpendicular vector) will be taken on as the velocity on $z for the next frame before all of this math processes again.
(Each particle $x, $y, and $z, will go through this math for each of the other 2. basically forming a triangle plane in 3d space spinning around itself)
What I'm looking for is a way of assigning particle -2, particle -1, and particle 0 velocities all on one frame.
So is there some way of doing this --
particleShape1.pt[$x].velocity=$crossProdX;
particleShape1.pt[$y].velocity=$crossProdY;
particleShape1.velocity=$crossProdZ;
but with it working in mel.
I'm not really looking to make any extra per particle array attributes but, even if I had to make another attribute Per Particle on the particle system to maintain the vector arrays to be called on the next frame, sure, but how do I even set that
particleShape1.customVelocity[12]=$x math
particleShape1.customVelocity[13]=$y math
particleShape1.customVelocity[14]=$z math - CurrentFrame
I hope that was clear enough. I'm open to any suggestions if I should go about this another way. I'm just trying to get used to working with particles and runtime exps.
Thanks in advance
