View Full Version : Connect fields only to moving particles only?

11 November 2009, 10:45 AM

I've got the following problem. On a plane I created some particles using surface emission, now the plane is covered with particles and these are lying still.

Now a locator with a drag field attached to it is animated through the particles, pushing them around a bit. I want only those particles that are pushed around to be affected by other fields, too- e.g. some turbulence and gravity.

Is there any means of doing this? The only thing I can think of is doing something via the collision event editor(on collision particles are handed over to a different particles system with forces exclusively bound to this particle system), but isn't there some simpler way of doing this?

11 November 2009, 10:58 AM
Just check each particles velocity and set the per-particle magnitude of the fields based on it.

11 November 2009, 01:31 PM
a per particle magnitude from a field is exactly what i need too. but how can i get this? i wrote an expression that calculates the distance for each particle to an goal object and put this to an pp-attribute. now, how can i use this pp-attribute to control the magnitude of the surrounding field per particle?

11 November 2009, 01:39 PM
Thanks for the reply...but that seems a bit problematic, as I am getting very strange results when querying the velocity.

Doing something like:

getParticleAttr -at velocity[1000]

gets me that:

// Result: 0 1 0 0 0 0

I do not understand, why I am getting six int values when expecting three float values.

Even though this might stand for 0.1/ 0.0/ 0.0 it's still confusing because I am getting this result for every particle.

My particles are lying motionless on a plane I am using for surface emnission (Speed 0).

11 November 2009, 01:47 PM
Why are you doing it that way? In a particle expression you don't need to use that syntax.

vector $vel = velocity;

if ($vel != << 0, 0, 0 >>)
gravityField1_magnitude = 1;
} else {
gravityField1_magnitude = 0;

I think that should work but I can't test it.

This (,topicNumber=d0e392484) is the documentation page about per-particle field magnitudes.

11 November 2009, 04:39 PM
THank you very much. I did it "that way" because I was just checking stuff via MEL before writing an expression.

11 November 2009, 05:02 PM
thank you too for pointing me to the right part of the documentation. i was blind. now i'm blinded by the possibilities i got. works very good.

03 March 2010, 05:31 PM
What about the Curve Field? It doesn't have an "apply per vertex" attribute, right? Isn't PP stuff possible with that?

(And sorry for picking up this old thread.)

EDIT: Maybe beacause it doesn't make much sense to use it...

03 March 2010, 06:31 PM
What about the Curve Field? It doesn't have an "apply per vertex" attribute, right? Isn't PP stuff possible with that?

The apply per vertex attribute is for when you make a particle system the source of a field and wish to have the field emitted from each particle(as opposed as to centroid of the particle system). This doesn't work for all field types and settings.

However if instead you wish to control the magnitude of a curve field(or any other field) per particle then you simply create a per-particle attribute with a name matching the field and the attribute on the field you wish to control per-particle:

For example:

...As was mentioned. Note that you could also control attributes other than magnitude.
Once you create the attribute you must set it somehow, for example in an expression, because the default value will be zero for all particles.


03 March 2010, 06:37 PM
Thanks Duncan. Thought so. Then either I misunderstand the docs, where it says:

To apply per-particle field attributes
Apply a field to a set of particles.
In the particleShape Attribute Editor expand the Add Dynamic Attributes section, if necessary.
Click the General button. The Add Attribute dialog box is displayed.
Create a per-particle attribute of float or vector type on the particleShape or nParticleShape with the name fieldName_attributeLongNameOnTheField or fieldName_attributeShortNameOnTheField. The type for the per-particle attribute you use must match the attribute type on the field. For example, create airField1_magnitude to control the magnitude on airField1.

Write an expression to control this attribute.
In the field’s Attribute Editor, go to the Special Effects tab, and turn on Apply Per Vertex.

Or someone could write a comment to the sixth point mentioning this is only necessary for using particles as the source for fields.

03 March 2010, 07:50 PM
Hmm... that might be a doc error, unless it is a fragment of a longer workflow to have emitted field per particle along with control of the the effect of the field per particle. (although I did not see any step saying to make the particle the field source) Unless one is using a particle system as the source for a field I believe the applyPerVertex button will be greyed out, and thus one couldn't select it. I'll look into this to see if the doc is wrong.


CGTalk Moderation
03 March 2010, 07:50 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.