Sorting particles by distance (proximity to point)

   8213   5   3
User Avatar
Member
279 posts
Joined: Dec. 2009
Offline
I would like to create a new attribute id on particles based on distance from origin.

So, how could i sort some particles at a specific frame, based on distance, like Sort SOP “Proximity to Point”.

I can calculate distance (length) in POP VOP, but how can i transform in unique integer, from 0 to X (0,1,2,3,…,X)


Thanks.
User Avatar
Member
1 posts
Joined: March 2014
Offline
I've attached a file with a solution if this is what you mean.

Used a vop sop to calculate the distance from the origin for each point into an attribute.

Then use the sort node by this attribute…

Then a new id attribute based on point number. Copied the new id attribute back on to the original points in case you don't want to change the point order…

Hope this helps…

Attachments:
id_by_distance_from_origin.hip (70.9 KB)

User Avatar
Member
279 posts
Joined: Dec. 2009
Offline
Thanks for reply, but no, it isn't what i'm looking for.

I want to sort directly inside a POP VOP at a specific frame. I need to sort my particles and it's impossible inside a popnet.
I need this to attract particles on another animated geometry with a POP Attrack, and i want the closest particles be attracted by the proximity of geometry. So my geometry is sorted by distance from origin, and i want sort my particles in the same way but at a specific frame.

Thanks anyway
User Avatar
Member
1391 posts
Joined: Dec. 2010
Offline
Another way is to add a simple point on the origin position , Then use neighbour and neighbourcount VOP nodes , Maybe it can help you :?
https://www.youtube.com/c/sadjadrabiee [www.youtube.com]
Rabiee.Sadjad@Gmail.Com
User Avatar
Member
84 posts
Joined: May 2012
Offline
If you are doing pops inside DOPs you can use a SOP solver with a SORT to sort them by proximity to your desired point and then use that attribute inside your POPVOP.

I did a quick example, check it out.

For ilustration I color the particles inside a POPVOP with a ramp based on the proximity id created based on proximity to a the Null object.

Is this what you were trying to do? or did I misunderstood?

Attachments:
id_by_proximity.hip (267.1 KB)

User Avatar
Member
279 posts
Joined: Dec. 2009
Offline
Thanks robonilla, it's exactly what i was looking for.

I always forget Sop Solver, though so pratical…

Thanks a lot.
  • Quick Links