PDA

View Full Version : check if nparticle is inside a volume primitive


mowax74
10-14-2009, 02:17 AM
i have nparticles stick to a surface with instancer on it. now, is there a way to check, if a particle is inside a volume primitive (sphere)?
i've created an pp-attribute, which should represent this (values 0/1).
i need this attribute to control the scale for the instance on the underlaying particle on runtime, while the volume-sphere moves.

thanks in advance for any suggestions.

Baalz
10-14-2009, 08:02 AM
Seems to me the easiest way to do this would be to add a volume axis field in the shape of a sphere with all settings set to 0 except the magnitude (so it doesn't cahnge the behavior of your particles )to the particles and parent it to the sphere.
Then check the connection to the inputForce of the particle system (should be something like volumeAxis1.outputForce[x] connected to particleShape1.inputForce[y])

And finally add in the run before dynamics expression of the particles:

if(inputForce[y]>0)
customAttrPP = 1;
else
customAttrPP = 0;


Here you go, hope that helps,

Mat

PS: sorry for my english

mowax74
10-14-2009, 12:27 PM
thx baalz. it worked. but i had to set a little force. only magnitude set to 1 doesn't work. i set a little axial speed too. but friction and stickiness of the particles are high enough to be not influenced by that.
now it does what i want.

Baalz
10-15-2009, 08:38 AM
Ur welcome, good to know a little force is needed for this trick to work.

Mat

CGTalk Moderation
10-15-2009, 08:38 AM
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.