0

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

mdivjak
  • 11
  • 2

1 Answers1

0

Instead of query you are creating a emitor every time and its ends up a string list error with this int $numPar =particle -ct nParticlShape; probably you want int $numPar =particle -q -ct nParticlShape; this

Achayan
  • 5,720
  • 2
  • 39
  • 61
  • Thank you Achayan for your response. I made the change you suggested and this definitely solved the error problem, thank you! Unfortunately, the joint rotation does not return to 0 with the above expression. Instead I went with the first expression and swapped the values thus: – mdivjak Jul 27 '16 at 00:01
  • if (nParticleShape.age < nParticleShape2.lifespanPP) longMuscleController.rotateY = -0.05; else if (nParticleShape.age >= nParticleShape.lifespanPP) longMuscleController.rotateY = 0; – mdivjak Jul 27 '16 at 00:04