André Graf

craboom

About Me

EXPERTISE
Gamedev
INDUSTRY
Gamedev

Connect

LOCATION
Germany
WEBSITE

Houdini Skills

Availability

Not Specified

Recent Forum Posts

Asset interaction is slow Oct. 17, 2019, 11:45 a.m.

just another bump… still slow and laggy in editor. Still no solution from Epic?

Select Point A, select another point, PontB above Point A. If no point found, select another PointA and repeat Sept. 23, 2019, 2:37 a.m.

no one can help me out with this?

Select Point A, select another point, PontB above Point A. If no point found, select another PointA and repeat Sept. 6, 2019, 4:58 a.m.

I´ve talked to a programmer who´s not familiar with houdini but with C. He gave me a possible solution.

My question here is, is it nessecary that i have to create a random algorythm for this particluar thing or is there an even better / easier approach?

Here´s what he made for me:

int pts[];
vector posi[];
int takenPositions[];
int height;
vector pos;
float seed;
int findTopPoint;

@rand;

/////////////////////

pts = expandpointgroup(0, "*");
pos = point(0, "P", @ptnum);
height = chi("height")-1;
findTopPoint = 0;


// random algorythm
seed = ch("seed");
@rand = floor(rand(seed)*@numpt);
if(@ptnum > 10){
    while(@rand < @ptnum && find(takenPositions, @rand)<0){
     
         push(takenPositions, @rand);
         seed +=1;
         @rand = floor(rand(seed)*@numpt);
    }
}
if(@ptnum == @rand){
    findTopPoint = 1;
}


// select point > y
float range = 0.001;
if(findTopPoint == 1){
    foreach(int pt; pts) {
        vector currentPos = point(0,"P", pt);
        if(
        currentPos.x <= @P.x + range && 
        currentPos.x >= @P.x - range &&
        currentPos.z <= @P.z + range &&
        currentPos.z >= @P.z - range &&
        currentPos.y > @P.y &&
        point(0,"selected", @ptnum) != 1
        ) {
            setpointattrib(0, "selected", pt, 1, "set");
            @selected = 1;
            height--;
            if(height<=0){
            break;
            }
        }
    }
}

I know this is not the best solution but it works and i have to figure out whatßs going on here and honestly, i also have to figure out how i can approach this, cause, like i said, i´m very new to coding, but i´m happy that i have something to work with
Still wondering if it´s the correct way doing it, thought there would be a nicer / easier solution