Jump to content

Moving objects using VEX


victorrijo

Recommended Posts

Hi everyone,

 

I'm trying to make something similar to this using VEX.  

 

For some reason my cube its "jumping" every time it changes direction. (see attached video)

Here's the code I wrote so far:

 

f@random = random(@Time);
@random = fit01(@random, 0, 3);


//moves in X
if (@random < 0.5){
    @P[0] += (@Frame / 15);
}
//moves in Y
else if (@random > 0.5 & @random < 1.5){
   @P[1] += (@Frame / 15);
}
//moves in Z
else{
   @P[2] += (@Frame / 15);
}

I tried doing the same using VOP (see attachment) but I'm getting the same results. 

 

 

randomXYZ.mov

post-15604-0-97447100-1457736735_thumb.p

Edited by victorrijo
Link to comment
Share on other sites

Thanks, the solver sop worked great. I changed the vex code as well. 

 

f@random = random(@Frame);
@random = rint(fit01(@random, 0, 6));


if (@random == 0){
    @P[0] += 0.1;
}

else if (@random == 1){
   @P[1] += 0.1;
}

else if (@random == 2){
   @P[2] += 0.1;
}

else if (@random == 3){
    @P[0] -= 0.1;
}
else if (@random == 4){
    @P[1] -= 0.1;
}
else {
    @P[2] -= 0.1;
}

 

randomxyz.mov

  • 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...