point function troubleshooting

   1891   4   0
User Avatar
Member
1007 posts
Joined: April 2017
Offline
Hi!

I'm using a point function on a resampled line and the result is always zero. Can you guys tell me what I'm doing wrong?

f@xyz = @P.x + @P.y + @P.z; //to get a different float value per point
float seed = point(0, “xyz”, 0); //to pick a different value to use in a rand function later

f@Check = seed; //when I check in the spreadsheet, I get 0 at every point…

Attachments:
point_function_problem.jpg (176.5 KB)

User Avatar
Member
8541 posts
Joined: July 2007
Online
olivierth
f@xyz = @P.x + @P.y + @P.z; //to get a different float value per point
float seed = point(0, xyz, 0); //to pick a different value to use in a rand function later

first line: sets value of f@xyz of the current point in the current geometry
second line: point(0, “xyz”, 0);takes value of xyz attrib from the first input, not the current geo, therefore if xyz attrib was 0 before it will get 0

EDIT: unrelated to the particular issue, you may get better random number if you base it on vector v@P directly instead of jumping through hoops to unnecessarily compute float seed from vector, so just do
float rand = rand(v@P);
Edited by tamte - April 9, 2018 14:51:14
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
1007 posts
Joined: April 2017
Offline
Hi tamte,

I'm not sure I understand the part: “takes value of xyz attrib from the first input, not the current geo”. Isn't it taking what's connected in input zero of the wrangle (0,1,2,3), to verify the xyz value of the point number 0?

What would be the right way of getting the xyz value of the point 0? (the result should be 0.4 according to the geometry spreadsheet)

-Olivier
User Avatar
Member
475 posts
Joined: July 2005
Offline
Hi,

It is taking only what is created before.
So one possible solution can be creating another wrangle before, where you create the xyz attribute and after this you can read this out the way you did.
Or you read out the point attribute ‘P’ for the point zero and calculate the xyz as local value from a function.

Attachments:
example.hipnc (72.4 KB)

User Avatar
Member
1007 posts
Joined: April 2017
Offline
AHHHHHHHHHHHHHHHHHH!!!

So, it's only getting info from the node before. Wow, I was stuck on such a small detail…

Thanks for all the help, guys!

-Olivier
  • Quick Links