Jump to content

Joy of Vex 7 coding issue


stephenhalker

Recommended Posts

i'm going through the "Joy of Vex" and i've run into an issue at day 7.

this code (below) isn't giving me the results of this gif.

///////////////

 int pt = nearpoint(1,@P);
 vector pos = point(1,'P',pt);
 float d = distance(@P, pos);
 d *= ch('scale');
 d += rand(pt);
 d -= @Time;
 @P.y = chramp('pulse',d)*ch('amp');

///////////

File:Ripples.gif

Joy_of_vex7issue.hipnc

Link to comment
Share on other sites

Oh, and when I cancel out the rand(pt); it gets closer to the example gif.

but still, I'd love to know what the right code is for getting that random positioning.

int pt = nearpoint(1,@P);
 vector pos = point(1,'P',pt);
 float d = distance(@P, pos);
 d *= ch('scale');
 //d += rand(pt);
 d -= @Time;
 @P.y = chramp('pulse',d)*ch('amp');
Link to comment
Share on other sites

The reason it doesn't look like in the GIF is because you connected your grid with "pointwrangle2" to your second input of "pointwrangle3". 
Connect your scattered points to the second input of "pointwrangle3" and you'll see that the VEX code does what it's supposed to do.

Edited by dleonhardt
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...