Jump to content

Drag by Proximity -Particles

Recommended Posts


So I have some particles flying around an animated sphere. I want these particles to slow down as it moves away from my sphere. I noticed in the preset vex expressions for drag it has a "Drag by Proximity to Point" expression. However, I am having a tough time understanding this...

// Drag by Proximity to Point
vector target = {0, 1, 0};         // Target position
float dist = length(@P - target);  // distance to target
float radius = 2.0;                    // Effect radius
dist = fit(dist, 0, radius, 0, 1); // fit to range
airresist *= dist;



vector target = {0, 1, 0};     <<<---- where exactly is this y value ? Is this y value in relation to my animated object ? How can I set my target to be the centroid of my emitter

dist = fit(dist, 0, radius, 0, 1);   <<<---- how is the distance and radius related in regard to a fit function ?


I'm wondering if there is any easier way to get my particles to slow down as it moves away from my emitter and almost look like it is following my object. I know a pop attract will work, but it takes a while to get the correct settings..


Thank you

Share this post

Link to post
Share on other sites

You can always use the pop proximity if you are having difficulties to understand the vex code.

Right now target variable is just saying that is 1 unit up in Y 
if you want to you obj there, you can use the point function.
The fit function is just taking whatever output you are getting from the dist variable and shift them to the new values between 0 and 1, in this case (0,1), if that makes sense.

Looking at the spreadsheet will help you understand what is going.






Share this post

Link to post
Share on other sites

Hi Logix1390,

The vex code you are using does something else than slowing down when the distance between your emitter and your particles is growing. Actually it's doing the opposite: it's slowing down when your particles are approaching the target. In the " // Drag by Proximity to Point" code you can define the target you want by replacing the target position. To understand easily what is going on, i always consider the process for a single particle. As you say you get it, did you do it in vex?


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