Array

   4194   2   0
User Avatar
Member
2 posts
Joined: Aug. 2015
Offline
Plzz help…
I took a plane with 0-99 points and i want to invert direction of. Velocity randomly by taking point number
For this i used array to store point no.but its only storing one last no.

Float x_array;
For(i@c=0;@c<@numpt;c++)
{
X_array=rand(@ptnum);
}
User Avatar
Member
323 posts
Joined: Jan. 2015
Offline
in vex wrangels you have two modes:
one runs over every point the other detail will only run once…

You dont need to store the values in an array…

for a great reference to learn vex look here: http://www.tokeru.com/cgwiki/?title=Houdini [www.tokeru.com]
User Avatar
Member
2127 posts
Joined: Sept. 2015
Offline
Sometimes you do need to create and store an array; and for that purpose alone you can do the following with the wrangle set to Detail(once only):

float @x_array[];
float Randomized;

for( int c = 0; c < npoints(geoself()); c++)
{
Randomized = rand(c);
push(@x_array, Randomized);
setpointattrib(geoself(), "point", c, Randomized , "set");
}

However, if just want to assign those values to each point just have your wrangle set to run over points with:

f@Random_V = rand(@ptnum);
Edited by BabaJ - March 6, 2018 16:16:48
  • Quick Links