Register Latest Topics
 
 
 


Reply
  Author   Comment  
JeremyR

Moderator
Registered:
Posts: 1,050
Reply with quote  #1 
I want to lay out some instances row by row so object one occupies vert IDs 1-20, 41-60, 81-100 etc and object 2 occupies the other verts in between.
The obvious logic would be to use else if statements but if there are hundreds of rows this could take some time to write.

Is there a better way to do this?
0
pshipkov

SOuP Jedi
Registered:
Posts: 4,711
Reply with quote  #2 
If the point order fallows some pattern then we should be able to come up with math formula that produces the desired results.
Otherwise we can try to transfer attributes from ordered geometry onto the "messy" one before doing the math formula thing.
0
JeremyR

Moderator
Registered:
Posts: 1,050
Reply with quote  #3 
The point order follows a pattern - default polyplane.
Attribute transfer is something I haven't done before, though I dont need that right now.
0
ZC

Cooking networks
Registered:
Posts: 142
Reply with quote  #4 

for ($i=1;$i<21;$i++){
for($n=0;$n<100;$n++){

if(id == $i+40*n)
return 1;

}

}

You need to loop, I do not know it is wrong, hope can give you inspiration

0
JeremyR

Moderator
Registered:
Posts: 1,050
Reply with quote  #5 
Thanks! Ill try it out and get back to you.
0
rolfcoppter

Wanting the recipes
Registered:
Posts: 63
Reply with quote  #6 
Hey, I also have a different way of doing this using a mod function in mel. I ran into this problem a while ago and I found this way a bit easier to understand and use.

The mod function (%) basically just counts up on the vert ids from 0 then when it hits vert ID 40 it goes back to 0. Mathematically it just returns the remainder of the division of two numbers. If $ID is 1 then it's 1/40 = 0 with a remainder of 1 so it returns 1, and if the $ID is 41 then it also returns 1 because 41/40 = 1 with a remainder of 1. 

float $modID = $ID % 40;
if ($modID <=19){
    $instanceID = 0;
}
else{
   $instanceID = 1;
}

I normally use this in the Point Node and then pipe the out WeightPP into the copier node index array. But there are many ways to do it as there is with anything.


hope this helped and sorry for the late reply to this old thread.

thanks,
Jordan
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation: