CinnamonMetal Posted March 22, 2018 Share Posted March 22, 2018 if(@primnum>45){ vector ghh = point(1,"P",i); removeprim(0,ghh,1); I'm hoping I can get some help. *ghh* is a variable which represents a sphere. What I want is, when moving the sphere around if it should come in contact with primitives with numbers greater then 45 then it removes those primitives; although it's not working, what am I doing wrong ? Quote Link to comment Share on other sites More sharing options...
fsimerey Posted March 22, 2018 Share Posted March 22, 2018 https://www.sidefx.com/docs/houdini16.0/vex/functions/removeprim Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted March 22, 2018 Author Share Posted March 22, 2018 I see my error. What I should've asked is; how can I translate a sphere around and when it comes in contact with the primitives of another object as in a sphere, it deletes primitives based on a threshold distance ? Quote Link to comment Share on other sites More sharing options...
Sepu Posted March 22, 2018 Share Posted March 22, 2018 one simple way is using an attribute transfer as I mention before, there is many ways to do this. deleteprims.hipnc 1 Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted March 22, 2018 Author Share Posted March 22, 2018 What are the other ways ? Quote Link to comment Share on other sites More sharing options...
StepbyStepVFX Posted March 23, 2018 Share Posted March 23, 2018 Is your sphre (the « trigger » object) a simple primitive (therefore only one point), or is it polygon sphres, with many points ? What you can do is use the xyzdist vex function to calculate, for each point or primitive of your object, the closest distance to the sphere, and when it reaches a threshold close to zero (ie. When there is contact), you use removeprim. But this is very similar to the use of the trasnfer attribute and grouping method explained above. Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted March 23, 2018 Author Share Posted March 23, 2018 It's a single primitive, therefore with one point. Quote Link to comment Share on other sites More sharing options...
Sean-R Posted March 23, 2018 Share Posted March 23, 2018 (edited) This should work: // Get distance of primitive to point position of second input, Sphere is plugged in to second input // float dist = distance(@P, point(1, "P", 0)); // Get radius of sphere, I made a relative reference to the spheres scale in the radius parameter that is created // float rad = chf("radius"); // If the primitive is inside the sphere, delete// if(dist<=rad){ removeprim(0, @primnum, 1); } Edited March 25, 2018 by Sean-R Fixed code error 1 Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted March 24, 2018 Author Share Posted March 24, 2018 Shouldn't it be dist, rather then @dist ? Quote Link to comment Share on other sites More sharing options...
Sean-R Posted March 25, 2018 Share Posted March 25, 2018 Yes! I've fixed the code 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.