Jump to content

Drag by Proximity -Particles


logix1390

Recommended Posts

Hello,

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;
 

--------

Question:

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

Link to comment
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.

http://www.sidefx.com/docs/houdini/vex/functions/fit

 

 

 


 

Link to comment
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?

 

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