1 Maya Tutorial Making a Blizzard 2/4 Fri Sep 24, 2010 2:05 am
Admin
Admin
Go to per particle (array) attributes tab. Click Add button . In particle tab choose collisionTime. This attribute stores time when particle collided.
[You must be registered and logged in to see this image.]
If you wonder what is the value of collisionTime for each particle, you can do this: 1. Right click on particles, in marking menu choose particle. 2. Select all particles.
[You must be registered and logged in to see this image.]
Go to window/general editors/component editor. In particles tab there’s collision time. It is -1 for each particle. Collision time changes value only in the moment particle collides. We will base our expression around that fact.
[You must be registered and logged in to see this image.]
By the way, the second way to query attribute values is to set mode to Numeric. In attribute name enter the name of attribute you want to see.
[You must be registered and logged in to see this image.]
Also, add particle attribute named Status. It must be per particle (array), because every particle will have its own value for this attribute.
[You must be registered and logged in to see this image.]
Right click on your newly created attribute. In menu choose runtime after dynamics. Enter the expression from the picture. So the first if will query if Status is less than 1. Status is by default 0, so commands inside this if will execute by default unless we change the value of the status attribute. The second if queries if a collision has occurred. When particle collides collisionTime get’s value. If collision occurs it will set Status to 1. So when whole expression is executed next time, first if will not allow any of commands inside to be executed. In other word’s it will skip everything.
[You must be registered and logged in to see this image.]
Status attribute looks like this.
[You must be registered and logged in to see this image.]
Add another attribute named velTMP. This time it must be vector type, since we will deal with velocity which is also a vector.
[You must be registered and logged in to see this image.]
Now go to runtime before dynamics. Enter expression from picture below. So if Status is less than 1 (if particle not collided) than particle will get remain its velocity.
[You must be registered and logged in to see this image.]
Edit after dynamics expression. This will set velocity to the last value before collision. That’s why we split expression in two parts.
[You must be registered and logged in to see this image.]
So, now it works.
[You must be registered and logged in to see this image.]
There’s another way to this. Set AimDirection to velTMP
[You must be registered and logged in to see this image.]]