Jump to content
Sign in to follow this  
dxhhx

POP Group Center

Recommended Posts

Hey guys,

 

Hopefully this is a quick one. I was wondering how I could find the average position of a group of particles (and store the position as an attribute on the particles in that group)?

Say I have two groups, A and B, and I want to find the average position of the particles in group A and create a force on the particles in group B to go towards that point (center of A), and at the same time have all the particles in group A move towards center of B.

POP Group A -> Center of POP Group B

POP Group B -> Center of POP Group A

 

Thanks :)

 

Share this post


Link to post
Share on other sites

Hey thanks for the file David! Haven't even crossed my mind to bring it into a SOP Solver. Would have liked to have access to the average position attribute for use with the POP Solver, but this will work for what I need.

 

Btw I tried to see if I can replace your "detail_avg_pos" wrangle with two attribpromote, but it doesn't seem to work. Do you have any idea why?

 

Thanks again, much appreciated :)

 

pop_avg_p_002.hip

Edited by dxhhx

Share this post


Link to post
Share on other sites

it's not working because when you are blasting the groups, the points still have both detail attributes on them from the previous frame but each blast only computes one. Since we are working with detail attributes and can only have one value per attribute,  the values from the left input of the merge are taking priority.  

I don't see why you can't use these attributes with other pop solver nodes, you can access it as a detail attribute or promote it to the point level every frame if that's easier.

Edited by dchow1992
  • Like 1

Share this post


Link to post
Share on other sites

Got it. Gonna use this now, thanks a lot dude!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×