VEX xyzdist: distance to a primitive number?{[SOLVED]}

   305   5   0
User Avatar
Member
1287 posts
Joined: April 2017
Offline
Hi!

I have no groups on my geo and want my point wrangle to detect the distance to a specific primitive from the second input. Each point searches for a different primitive.

The documentation talks about not needing a group if I use an expresion like: @Cd.x>0 (yet, I tested their example and it does not work...)
Edited by olivierth - Nov. 17, 2026 14:46:22
-Olivier
User Avatar
Member
1287 posts
Joined: April 2017
Offline
I tried this:

xyzdist(1, "@primnum==0", @P, primhit, UVs);

but it returns the primitive -1. So thats a fail.
Edited by olivierth - Nov. 17, 2026 14:41:34
-Olivier
User Avatar
Member
9756 posts
Joined: July 2007
Offline
maybe share what exactly you tried?
one think to keep in mind is that the attribute in adhoc group string has to be a primitive attribute on the lookup geo
alternatively you can also directly use string of any primitive number or pattern that group parms accept, so not necessarily named groups
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
9756 posts
Joined: July 2007
Offline
olivierth
xyzdist(1, "@primnum==0", @P, primhit, UVs);
@primnum is not an attribute so in your case just use
xyzdist(1, "0", @P, primhit, UVs);
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
1287 posts
Joined: April 2017
Offline
AHHHHHH!!!!

Ok, like you were saying (I think), it has to be a primitive attribute visible in the geometry spreasheet (@primnum is not). I created a prim attribute i@primnumREF and now, my script works!

float dist = xyzdist(1, "@primnumREF==3", @P, primhit, UVs);

EDIT: I replied right after tamte...
Edited by olivierth - Nov. 17, 2026 14:47:20
-Olivier
User Avatar
Member
9756 posts
Joined: July 2007
Offline
olivierth
I created a prim attribute i@primnumREF...
but again, there is no need for this if you want to match 1:1 prim numbers, just use the prim number directly as a string like mentioned
Edited by tamte - Nov. 17, 2026 15:06:48
Tomas Slancik
CG Supervisor
Framestore, NY
  • Quick Links