PDA

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


Phlok
11-03-2009, 10:45 AM
Hi,

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?

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

mowax74
11-03-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?

Phlok
11-03-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 particle1.pt[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).

Cheesestraws
11-03-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 (http://download.autodesk.com/us/maya/2010help/index.html?url=Fields__Work_with_perparticle_field_attributes.htm,topicNumber=d0e392484) is the documentation page about per-particle field magnitudes.

Phlok
11-03-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.

mowax74
11-03-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.

derMarkus
03-11-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...

Duncan
03-11-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:
fieldname_attributename

For example:
gravityField1_magnitude

...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.

Duncan

derMarkus
03-11-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.

Duncan
03-11-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.

Duncan

CGTalk Moderation
03-11-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.