gazegaze Posted November 12, 2022 Share Posted November 12, 2022 (edited) Hi, Learning VEX and this is simply out of curiosity since I'm trying to build an intuition for how houdini works under the hood. I know I can read a vector from say point 5, like so: vector test = point(0, "P", 5); printf("%f", test); {0.091506,0.482963,-0.091506} Is there a way I can directly access only a component, like P.x with the point function? To my surprise, substituting "P" with "P.x" doesn't work, i.e: float test = point(0, "P.x", 5); printf("%f", test); 0.000000 I know I can access it via variable indices in the first example like vector test = point(0, "P", 5); printf("%f", test[0]); 0.091506 but it doesn't seem to work within the function. Neither "P.x" nor "P[0]" works. Is there a good reason for this? Grateful for any input you may have! GG Edited November 12, 2022 by gazegaze Quote Link to comment Share on other sites More sharing options...
haggi Posted November 18, 2022 Share Posted November 18, 2022 You cannot retrieve point attribute components this way, you will have to read the vector and then as you already know, use the component from this vector. Quote Link to comment Share on other sites More sharing options...
Nippelmanius Posted November 18, 2022 Share Posted November 18, 2022 In order to access a single vector component, you would need to explicitly type cast the point() function to vector: float test = vector( point( 0, "P", @ptnum) )[0]; Quote Link to comment Share on other sites More sharing options...
gazegaze Posted November 22, 2022 Author Share Posted November 22, 2022 Thanks alot guys, appreciate it! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.