Search the Community
Showing results for tags 'infect'.
-
Hey! I was going through some tutorials on growth solvers, and I noticed that a lot of them are driven by the "food" group looking to get "infected" if you know what I mean. I wanted to try and make a growth solver that workes differently, looking instead at the points that are already infected and infecting more from their perspective. A very simple summation of what I'm trying to achieve: 1. List the points around me 2. If they are food, they are candidates 3. Infect only 1 of the found candidates rinse and repeat I've put the code underneath in a point wrangle in a solver, but it doesn't work well. I tried running the command on the seperate food and infected groups but that doesn't seem to improve either. What happens when it doesn't go well: 1. nothing 2. Almost every point gets put into the infected group in 1 framespan and then the solver doesn't do anything anymore. //initialiation of radius to search for, and random seed; float radius = 0.2; float seed = 8008135; //stalking prey (finding a list of points to infect); int neighbours[] = nearpoints(0,@P,radius,5); //hopefully grabbing a random one out of the stack of many; float array_length= len(neighbours); //random number between 0 and the length of the list of neighbours; int targetp = rint( rand(seed) * array_length); //looking up point ID in list of neighbours; int point_to_infect = neighbours[targetp]; //actually infect the point, if it is food; if (point(0,"infection",point_to_infect) == 0){ setpointattrib(0,"infection",point_to_infect,1); }; I haven't any clue what's going on, I got no errors other than a little green line under the local variable "targetp" when it gets created. I've attached my .hip! It might be something else I'm doing wrong. I hope you can help me, thanks in advance, Sasbom active infection.hip
-
I just followed a video tutorial found on the sideFX website titled :Houdini Quicktip#03 - Infecting points using VEX & the solver SOP. I I'm embarrassed to say i'm confused by the code snippet provided. The set up starts with scattered points and an attribute @infect = 1 added to one point. which by default gives all other points @infect = 0; Then an wrangle with this snippet is put in to a solver. if(@infect == 0){ int spnts[] = nearpoints(0,@P,1,5); foreach(int pt;spnts){ if(point(0,"infect",pt) == 1){ @infect = 1; @Cd = {1,0,0}; } } } this code works. But i'm confused why it does. Allow me to walk through the code as i understand it. if the points @infect value is 0 which on frame one is all points except one. gather the 5 nearest points and append them to the array spnts[] foreach of these 5 points with a @infect value of 0 check if its @infect attribute is equal to 1 and then set it to 1; What confuses me, first is this code is only operating on points with @infect == 0 because of the first conditional check. then the last conditional checks if @infect == 1 and if true sets it to 1. is't it already 1? sorry for the confused and confusing question. obviously I am on the rails somewhere. It would be super helpful is someone wants to enlighten me as to where my mistake is. thanks. B