André Graf

craboom

About Me

専門知識
Gamedev
業界:
Gamedev

Connect

LOCATION
Germany
ウェブサイト

Houdini Engine

Availability

Not Specified

Recent Forum Posts

Asset interaction is slow 2019年10月17日11:45

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 2019年9月23日2:37

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 2019年9月6日4:58

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