Adverti horiz upsell
Using Expressions in Maya 7: goalWeight and goalWorldPositionPP.
Using Expressions in Maya 7: goalWeight and goalWorldPositionPP.
robotball, added 2005-10-10 11:43:09 UTC 55,000 views  Rating:
(1 rating)
Page 1 of 4

By Eric Keller

This tutorial will demonstrate some ways in which you can use the new per particle goal attributes introduce in Maya 7.

Traditionally goals are away to move particles about the scene, much like fields. However, the techniques discussed here will use goals to get information about where are particle is in relation to a locator/goal and that will be fed back into the expression to create a "freeze field".

In essence this is not really a field since it is controlled through particle expressions related to the particle itself and can thus only affect this particular particle. However its kind of like a field in its implementation.

Indeed there are easier ways to create a freeze but this exercise is more about the new per particle attributes available in Maya 7 than creating a particular effect.

The goalPP attribute is nothing new, its been in Maya for a while. What is new is the per particle per goal weight, position, normal, tangent U and tangent V per particle attributes. These are available for each goal that is affecting a particle, thus you can now have different goalpp weight attributes for different goals.

I will only be talking about the goal weight pp attribute and the goal world position pp attributes. The others are there for you to discover.

Lets get to it.

I recommend that you download the scene file from my website and use it as a reference. The file is at freezeField2.zip. This article assumes that you are familiar with creating particle expressions in Maya.

The "freeze field" I will be creating works like this: There will be a couple locators in the scene, which will be our fields. As a particle comes into a certain range of the field it will be stopped in its tracks.

The range will be controlled by a custom attribute placed on the freeze field, and some nurbs spheres will act as a visual aid for viewing the size of the field.

Lets start by making the two fields.

1. Create a locator and name it freezeField0 (There's a reason why I've named it with a zero instead of a one, this will become more clear later.)

2. Create a sphere, name it fieldRange0, set the sections and spans to 1 so that its easier to see in wirefame mode.

3. Point constrain the sphere to the locator.

4. Select the freezeField0 locator and open its attribute editor. Add a custom attribute by choosing Attributes>add attribute from the attribute editor menu.

5. In the dialogue box for adding the attribute set the name to "fieldSize". Set the data type to float.

6. Open up the connection editor and load the freezeField0 locator on the left size and the fieldRange0 sphere on the right. Connect the fieldSize attribute to the sphere's scale x,y, and z attributes. The sphere should dissapear as its scale is now zero.

7. Close the connection editor and make sure the fieldSize attribute on the locator is properly controlling the scale of the sphere by changing its value.

8. Repeat the process to create a second locator called freezeField1 with its own fieldRange sphere.

9. Create an emitter. Set the type to directional with a speed and spread of 1. Things might be easier to see if you set the particle type to sphere and bring the radius down to about.08. Make sure that as the emitter spits out the particles, the freeze field locators are placed in the stream somewhere.