Jump to content

Advect particles with object


Mark01

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!!

:) 

 

 

Link to comment
Share on other sites

@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 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...