Search - User list
Full Version: vex pop for particle flocking
Root » Technical Discussion » vex pop for particle flocking
ben.toogood
say i wished to find the vector between one particle and all the others in the flock, would anyone be able to suggest how to access the P of the ‘other’ particles in the vex expression?

say a bit like this

vector myTotalVector;

for(i=0;i<the total number of particles;i++)
{
myVector = particleNumber_i.Posistion - currentParticle.Postion;
myTotalVector += myVector;
}

?
ben
anakin78z
you can and you can't.

in vex sops, you can use the import() vex function to import any attribute from another point. So you could run that loop if you wanted, and do all that good stuff.

In pops, sidefx decided to dissable this function (for reasons that they don't want you to be able to plug in 2 pop networks…. but I don't care! I want to be able to grab info from other particles!!! Think of it as a poppoint expression sesi!!!!!! :evil: )

anyhoo, I'm a bit bitter about that myself, but you can build a slow and overly convoluted system which does that in sops and feeds the information back to particles.

Cheers!
ben.toogood
thanks for confirming this,
ive had to move to expression functions instead (which seem a little slow)
ta for your help

ben
T-bolt
Hi, sorry for the really big topic bump :shock:, but I'm having the same issue…

I just want to be able to get the position information of each particle for my VEX POP function. My flock has only 12 members so I'm even willing to pass the positions in through the function parameters instead of within the function, but I'm not sure how to even get the information that way. :? Any ideas?

Thanks,
Paul
edward
anakin78z mentioned using the poppoint() expression function. (in textport: exhelp poppoint). So to use it, put poppoint(opinputpath(“.”,0), …etc…) expressions in your VEX POP parameters.

As for the second method that he mentioned, it's not too hard in H7. You create your POP Network in SOPs. Then when you want to do your VEX stuff, back up one level and append a VEX SOP instead. So just copy the contents of your VOP POP to the VOP SOP instead. This allows you to use the Import VOP to import the attribute “P” (point) given any particular point number.

Now when you want to do more particle manipulations, append another POP Network to the VEX SOP. Inside this new POP Network, create a Source POP. Set its Geometry Source parameter to First Context. Now you can continue with your regular POP work.
Ondrej
I don't believe the issue in the pop context was plugging in 2 pop networks. I believe that the problem we were trying to prevent was attempting to read an attribute that is being written to. VEX gives no guarantee on execution order, so this could be a problem.

That being said, it would appear that we decided to let users shoot themselves in the foot anyway as of 6.1.70, by allowing the import, getneighbour and getneighbourcount functions in the pop context. Interestingly enough, it's possible that we neglected to mention this little fact anywhere. At least I can find no mention of this in the VEX documentation.
edward
This is only a problem in POPs because it only keeps one copy of the geometry. That's why doing it via SOPs won't have this problem as we can then read from the input geometry and write to the output geometry.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB