Jump to content

Get input to DOP Network in POP wrangle


Matic3D

Recommended Posts

Hi all. This should be easy, but it's killing me...

 

I have a control object living outside a DOP network, a simple particle system. I've plugged it into the second input.

DOPinput.png.020f2536959ed104057472638859ac2c.png

Inside the DOP I access this control position without issue, in a VOP. However I then want to follow up by killing particles in a POP wrangle, based on distance to the control object...

POPwrangle.png.e12ab337768667c7ae926ab9de69f8d2.png

Easy right? Here's my vex:

f@dist = distance(@P, v@opinput0_P);

if ( @dist <= ch("threshold")) {
removepoint(0,@ptnum);}
 

... simple. But it kills particles around the origin, not the control object, as if v@opinput0_P = {0,0,0}

I've tried multiple variants on opinput, explicit path and the point function etc but it always gives me a "kill" radius around the origin, not the control object.

Anyone see what I'm missing?

Thanks in advance!

Edited by Matic3D
Link to comment
Share on other sites

Sepu, yes that does exactly what I'm trying to do. Interesting. Thank you! >bow<

I'm still interested why the proximity POP is necessary however.

Shouldn't this be possible with that single wrangle? It it necessary to get the control object's transform or something rather than "P"? Any wizards out there see what's missing?

 

Link to comment
Share on other sites

Hello Matic3D,

I made the changes as per your request: kill_MOD.hip

First of all thumbs up to Sepu, for doing a great job. It's the easiest fix for such a problem and it's always a good practice to keep things simple because I believe, as the sim gets more complex, it gets difficult to keep track of all the complex setups that we implement.

But I see that you wanted more data pulled from the control object into the sim. So, I modified Sepu's file a little bit. I got rid of the proximity pop node and inserted that functionality into the pop wrangle. I also changed how the threshold works. Now it gets that value from the control object. I assume something like this is what you were after.

Here is how it's done:

In the POP wrangle under the Inputs tab, I changed the input 2 to second context geometry. I have also set a controller for threshold in the SOPs level. So, now the POP wrangle now gets data from the second input connected to the DOPNET, which in our case is the control object.

Capture2.PNG.7031bfcad401d224f8d6ca6478e5b834.PNGCapture3.PNG.7c6f216bfd538b0d98809351f2ed1ff6.PNG

 

Now let's take a look at the code. The first two lines pull the data from our control object. Here I imported the position and threshold values into the variables pos and threshold respectively. Please note that I have used the point function for this. This is because if you take a look at the geometry spreadsheet with the control object selected, you can see that it's a point and it has both position and threshold values as attributes.

Now why "point(1, "P", 0)" ?  The 1 tells Houdini that I want to use the second input (In Houdini 0 means first input, 1 means second input and so on..) to get the data from, which is the control object. Since there is only one point coming from the control object I put 0 as the last argument to the point function.

In the third piece of code, I calculate the distance of the points from the control object using the distance function and store this value inside a variable called neardist.

Finally, in the last few lines, I compare the distance stored in the neardist variable to the value stored in the threshold and deletes points based on that calculation.

Capture.PNG.5f768b5d1421f802a32548d0cd32597f.PNG

Using this technique you can pull any data from the control object and use it in DOPS. Even if the control object's parameters change, it's still reflected in your simulations. Now let's imagine you have multiple points in your control object, then all that is required is to put the code in a loop and check for all the points in the control object. As you can see, the possibilities are basically endless.

I hope this answers your question

 

 

Edited by Eyeracker
  • Like 1
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...