vex help: connect prims based off attribute?

   2139   4   0
User Avatar
Member
1535 posts
Joined: 3月 2020
オフライン
Hi guys/gals

I'm having some issues trying to figure our how to connect prims together, but only to connect from one prim to another based off an levels attribute, so, connect level0 > level1, level1 > level2 and so on. At the moment I still get connections between say level0 and level3.

Prob missing something simple here..



thx
J

Attachments:
connectme.jpg (48.6 KB)
tree_branch_connect_v02.hipnc (167.7 KB)

fx and lighting @ rebelway
https://www.youtube.com/@jason_slab
User Avatar
Member
9430 posts
Joined: 7月 2007
オフライン
run your point wrangle only on roots group
with this code:
float searchrad = chf("Searchrad");
string grp = sprintf("\@level=" + itoa(i@level-1));
int nearpt = nearpoint(0, grp, @P, searchrad);
if (nearpt != -1){    
    int myprim = addprim(0, "polyline", nearpt, @ptnum);
}
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
1535 posts
Joined: 3月 2020
オフライン
Dam Tomas, works like a charm, thanks so much!
Just curious, what is the “\” for in the sprintf? seems to work without it..

I wish I could plug my brain into yours and suck our some of that knowledge!

J
fx and lighting @ rebelway
https://www.youtube.com/@jason_slab
User Avatar
Member
9430 posts
Joined: 7月 2007
オフライン
JasonSlab
Just curious, what is the “\” for in the sprintf? seems to work without it
it's just to escape the @ character, I recall it didn't use to work without it in the old versions, even though I'm not certain now
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
1535 posts
Joined: 3月 2020
オフライン
O interesting. I will look into that. Thanks again.
fx and lighting @ rebelway
https://www.youtube.com/@jason_slab
  • Quick Links