Maya nparticles stop rotation after collision


#1

hi guys
i have a simple nparticles been created with initial orient and rotation with some expressions , and the issue i is that on collision with the ground they keep on rotating.
i followed a tutorial online and i dont have alot of experience with expressions.
im using these expressions in the creation:
nParticleShape1.InitialOrient = <<rand(360),rand(360),rand(360)>>;
nParticleShape1.RotateFactor = <<rand(10),rand(10),rand(10)>>;
and in the after runtime:
nParticleShape1.InitialOrient += nParticleShape1.RotateFactor;

HOW CAN I MAKE THEM STOP ROTATING AFTER THE COLLISION?


#2

You could check if the velocity of the particles is below a certain value and turn rotation off if they are too slow.

Or you add the particles collisionTime attribute which is -1 if no collision occurred and turn off rotation if collisionTime is > 0.0.


#3

Thank you haggi!
I don`t know the syntax and i dont know code…
can you help me wright this?


#4

Hi im having this problem as well , how can i stop the rotation with the relevant expression?


#5

Okay, I try to explain:

  • go to the nParticle shapes “Add Dynamic Attributes” and click on “Genreal”
  • in the “Add Attribute” window go to the “Particle” tab and select “collisionTime” and click “OK”
  • Now you have a new “collisionTime” attribute in the “Per Particle (Array) Attributes” list.

The “collisionTime” attribute will be filled automatically by Maya. You can check it if you select “Nunmeric” as “Particle Render Type” under “Shading” in the nParticleShape and set “collisionTime” in the “Attribute Name”. Then all particles will have a -1 at start and as soon as they collide, the value starts to increase beginning from 0.

Now in the runtime expression where you increase the rotation, you can simply check for collisionTime like this (pseudocode):


if(collisionTime > -1)
{
do nothing
}else{
  increase rotation
}


#6

thank you so much!!


#7

thanks haggi this was very useful