Vex syntax getting Point Position

   13022   2   1
User Avatar
Member
5 posts
Joined: Sept. 2021
Offline
Hello,

I have a line with a couple of points. In a point wrangle I try to access the position P.y of point 0 .
When I use vector as type I can extract the position.

vector master_pos = point(0, "P",0);

But when I try to just access the position in y it fails and returns just 0.

float master_pos = point(0, "P.y",0);

What do I miss?
User Avatar
Member
2658 posts
Joined: June 2008
Offline
That's because P.y doesn't exist as an attribute and defaults to zero.
Try this instead.
// VEX: Fetch the Y component of point #3.
vector master_pos = point(0, "P",3);
float temp_y = master_pos.y;

What is interesting is that hScript supports the fetching of individual vector components, but VEX does not. Here is the equivalent using hScript.
// hScript: Fetch the Y component of point #3.
point("/obj/geo1/OUT_MESH", 3, "P", 1)
Using Houdini Indie 20.5
Windows 11 64GB Ryzen 16 core.
nVidia 3060RTX 12BG RAM.
User Avatar
Member
718 posts
Joined: Sept. 2013
Online
Casting to vector, then it works.

float master_pos = vector(point(0, "P",0)).y;
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
  • Quick Links