简体   繁体   English

在 Maya 粒子上使用 MEL 表达式来控制关节旋转

[英]Using MEL Expressions on Maya Particles to Control Joint Rotation

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.我现在想要做的是使用第二组粒子(具有定义的寿命。PP)来驱动关节旋转,再次使用表达式,即当粒子存在时,我不希望发生任何关节旋转,但是一旦它们死了,我希望关节旋转然后迅速归零,即收缩后迅速放松。 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.这个表达式很好地旋转了关节,但为了更好的控制,我真正需要的是另一个命令行来快速将关节旋转再次返回到 0。 At the moment, the rotation only returns to 0 when the particle emission begins again, and age is once again less than lifespan.目前,当粒子发射再次开始时,旋转仅返回到 0,并且年龄再次小于寿命。 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?我在想也许是另一个如果行,当粒子数 = 0 时(即一旦超过 lifespanPP 时所有粒子都消失了),再次旋转 y = 0? 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. Maya 说语法是正确的,但是一旦它执行并且不旋转关节就会抛出各种错误。 I'd really appreciate any advice on the correct MEL commands to use to rotate the joint then return to 0?我真的很感激有关用于旋转关节然后返回到 0 的正确 MEL 命令的任何建议? Apologies, but I'm really bad at this!抱歉,但我真的不擅长这个!

Thank you in advance for all your help and best wishes,预先感谢您的所有帮助和最良好的祝愿,

Maja玛雅

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 ;您每次都创建一个发射器而不是查询,它最终会出现一个字符串列表错误int $numPar = particle -ct nParticlShape ; probably you want int $numPar = particle -q -ct nParticlShape ;可能你想要int $numPar = particle -q -ct nParticlShape ; this

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM