Maya particle expression: Calculate trail length of particle doesn't seem to work?!


#1

Hello everybody. Been looking into particle expressions now again, which are quite cool, but has it become obsolete? No tutorials are done for it anymore.
I got ahold of an old one for Maya 4.0, but it’s a killer in which they create water trails on a Pepsi can using a pretty hardcore expression, Just wish I could get it to work.

The setup first emits particles(drop) for the motion down the can, then another set of particles(trailP) are emitted from drop, creating the trails and these are the ones that are rendered. Because the motion from the drop is irregular, incorporating pauses and acceleration, the idea here is to control the emission of the trail particles so it will be emitted based on the distance the drop particles have traveled.

I tried nParticles and it works okay, but due to the drop motion I get irregular emission and holes in the trail. I guess I could slow down the simulation as to be able to emit the particles closer to each other with a higher particle rate. But this makes the simulation so much heavier and I would like to learn what’s wrong with the expression.

HEREis the scene file containing the expression.

I set up my scene like the tutorial instructed. Only using legacy particles and it works perfectly for creating the drops particles, but when adding the trails, it bugs out, producing these error messages over and over.

// Warning: line 0: goalU is not a vector or scalar per-particle attribute. Skipping. //
// Warning: line 0: goalV is not a vector or scalar per-particle attribute. Skipping. //

The code that’s causing the problems is at the bottom, when concatenating the emit command:

$emitCmd += "-attribute goalU -floatValue " + $uValue + " ";
$emitCmd += "-attribute goalV -floatValue " + $vValue + " ";

I can’t seem to see what’s really wrong in the code though. The goalU is a per particle float value?