esnaacho Posted June 10, 2020 Share Posted June 10, 2020 Hello wizards, i have a little problem, and im not able to understand why my code doesnt work. I have: -a couple of points, -each with a vector attrib "size". -some code in a wrangle to order the points one above/under(direction shouldnt matter because im taking the absolut value, right?) the other without modifying the first point (0): if(@ptnum > 0){ vector last_point_size = point(0, "size", @ptnum-1); vector last_point_pos = point(0, "P", @ptnum-1); @P.y += ( abs(last_point_size[1]) + abs(last_point_pos[1]) ); } Here before/after the wrangle. Tint in blue everything that doesnt change. What am i doing wrong? Thanks in advance for your time. Quote Link to comment Share on other sites More sharing options...
fencer Posted June 10, 2020 Share Posted June 10, 2020 (edited) How about calculate real size of every letter and shift based on it? Looks like you are trying to do the same but I am not sure about your idea. ltower_v01.hipnc Edited June 11, 2020 by fencer Quote Link to comment Share on other sites More sharing options...
Noobini Posted June 10, 2020 Share Posted June 10, 2020 I'm not really contributing anything but just FYI there's Labs Align and distribute which does in all 3 axis (with spacing)...just in case you wanna dissect its innards. Quote Link to comment Share on other sites More sharing options...
esnaacho Posted June 11, 2020 Author Share Posted June 11, 2020 1 hour ago, fencer said: How about calculate real size of every letter and shift based on it? Looks like you are trying to do the same but I am not sure about you idea. ltower_v01.hipnc Thank you . i would look into it. 1 hour ago, Noobini said: I'm not really contributing anything but just FYI there's Labs Align and distribute which does in all 3 axis (with spacing)...just in case you wanna dissect its innards. thanks man! i was looking for that, i saw it in a video a long time ago, but i couldnt remember the node name, and i dont remember the video either. lool thanks ! I think i found out the problem. In the loop inside the wrangle: if(@ptnum > 0){ vector last_point_size = point(0, "size", @ptnum-1); vector last_point_pos = point(0, "P", @ptnum-1); @P.y += ( abs(last_point_size[1]) + abs(last_point_pos[1]) ); } when its in Point(0) - nothing happen when its in Point(1) - last_point_pos = Point(0)'s position. apply new pos. OK but when its in Point(2) - last_point_pos = Point(1) without the previous modification, so point 1 and 2 end up overlapping. :/ Quote Link to comment Share on other sites More sharing options...
esnaacho Posted June 11, 2020 Author Share Posted June 11, 2020 (edited) 2 hours ago, fencer said: How about calculate real size of every letter and shift based on it? Looks like you are trying to do the same but I am not sure about you idea. ltower_v01.hipnc finally, problem solved. With just one wrangle. Your hip file was very useful. thanks ! I had to calculate the total size of all previous points, then adding the current size. float total; for(int i=0;i<@ptnum;i++){ vector last_point_size = point( 0, "size", i ); total += last_point_size[1]; } @P.y = ( total + ( v@size[1]/2) ); Thanks everyone Edited June 11, 2020 by esnaacho changed variable name for easy understanding 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.