vex help: connect prims based off attribute?

   1306   4   0
User Avatar
Member
1533 posts
Joined: March 2020
Offline
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)

HOD fx and lighting @ blackginger
https://vimeo.com/jasonslabber [vimeo.com]
User Avatar
Member
8526 posts
Joined: July 2007
Online
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
FX Supervisor
Method Studios, NY
User Avatar
Member
1533 posts
Joined: March 2020
Offline
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
HOD fx and lighting @ blackginger
https://vimeo.com/jasonslabber [vimeo.com]
User Avatar
Member
8526 posts
Joined: July 2007
Online
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
FX Supervisor
Method Studios, NY
User Avatar
Member
1533 posts
Joined: March 2020
Offline
O interesting. I will look into that. Thanks again.
HOD fx and lighting @ blackginger
https://vimeo.com/jasonslabber [vimeo.com]
  • Quick Links