Jump to content
Mark01

Advect particles with object

Recommended Posts

Hi All!

 

I am trying to simply advect particles using the geometry of an object moving past them - I'm just looking for a small bit of interaction between them. 

Could someone point me in the right direction. 

Searching it online, all I seem to find is "popAdvectByVolume". 

 

Thanks so much!!

:) 

 

 

Share this post


Link to post
Share on other sites

@Mark01 Old particle system "POPNET" from 16.5 can be reproduced in 18.5...

if you have time download 16.5 open and investigate..Have Fun

Share this post


Link to post
Share on other sites
Posted (edited)

@Mark01 if someone Have Time? to make this for solver and 18.5 I  don't understand clearly :huh:
 

#pragma label damp "Damp"
#pragma label springIdx "Spring Index"
#pragma label magExp "Magnet Exponent"
#pragma label magnetScale "Magnet Scale"
#pragma label maxDist "Max Distance"



sop
SpringMagnet(float damp = 0.9;
            float springIdx = 0.5;
            float magExp = 1;
            float magnetScale = 0.5;
            float maxDist = 1;
               )
{
vector target = point(1, "P", 0);
vector rest   = point(geoself(), "rest", ptnum);

// get the spring force based on the rest position
vector displace = rest  - P;

vector springForce = displace * springIdx;

// get the magnet force from the target position
vector magDist = P - target;
float distance = length(magDist);

vector magnetForce = set(0,0,0);

if(length(distance) < maxDist){
    distance = pow(fit(distance, 0 , maxDist, 1, 0), magExp);
    magnetForce = normalize(magDist) * distance;
}

vector mainAcc = magnetForce * magnetScale + springForce;

v += mainAcc;
v = v * damp;
P += v;
}

 

paradv.gif

Edited by Librarian
  • Like 1

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

×