## 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 on other sites

@Mark01

Open in Houdini 16.5

##### Share on other sites

Thank so much for that!

I'm running h18. Is this file only for h16.5?

##### Share on other sites

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

##### Share on other sites

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

```#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;
}```

Edited by Librarian

## 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.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×
×