Jump to content

VEX code to create new points


catchyid

Recommended Posts

Hi, 

I am trying to create random points using VEX. Basically, It's a Geo node with only one Detail Attribute Wrangle node:

for(int i = 0; i < 100; ++i)
{
    vector pos=set(rand(0.1*@Frame),rand(@Frame),rand(10*@Frame));
    addpoint(geoself(),pos);
}

I get 100 points, but all have the same location? Any idea why all rand() is producing the same position for all points?

Thanks,

 

 

Link to comment
Share on other sites

you're getting different results for each frame, good, but for each frame, the 100 points are the same.

So you need another tie breaker, the 'i', just mult each Frame with i

for(int i = 0; i < 100; ++i)
{
    vector pos=set(rand(0.1*@Frame*i),rand(@Frame*i),rand(10*@Frame*i));
    addpoint(geoself(),pos);
}

Edited by Noobini
  • Like 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...