I've used an expression to emit particles on the death of a first particle object and it works really well. What I want to do now is use this second set of particles (with defined lifespan.PP) to drive joint rotation, again using expressions ie while the particles are in existence, I don't want any joint rotation to occur, but once they die off, I want the joint to rotate and then quickly return to zero ie relax quickly after a contraction. So, what I have is:
if (nParticleShape.age < nParticleShape.lifespanPP)
muscleController.rotateY = 0;
else if (nParticleShape.age >= nParticleShape.lifespanPP)
muscleController.rotateY = -0.1;
This expression rotates the joint nicely, but for greater control, what I really need is another command line to quickly return the joint rotation to 0 again. At the moment, the rotation only returns to 0 when the particle emission begins again, and age is once again less than lifespan. I was thinking maybe another else if line, something to the effect that when the particle count = 0 (ie once all the particles have died off when lifespanPP is exceeded), that rotate y = 0 again? I tried this instead, using particle count:
int $numPar = `particle -ct nParticlShape`;
if($numPar == 0)
muscleController.rotateY = 0;
else if($numPar > 0)
muscleController.rotateY = -0.1;
Maya says the syntax is correct, but it throws up all sorts of errors once it executes and doesn't rotate the joint. I'd really appreciate any advice on the correct MEL commands to use to rotate the joint then return to 0? Apologies, but I'm really bad at this!
Thank you in advance for all your help and best wishes,
Maja