Jump to content

What is wrong with my code


Gabriel_Wolf

Recommended Posts

Hello, 

I decided to finally start to learn vex. But I think now I rather suicide. :)

Can you tell me what is wrong with this code?

if (@P.y > 0){

v@Cd = set(0,1,0);}else {
v@Cd = set(1,0,1);}

if (v@Cd == set(0,1,0));{
v@N = 5;}

 

So basically I what is above zero should be green. And what is green should be get a normal with value of 5.

 

Thank you
 

Link to comment
Share on other sites

Hi Gabor, it seems to work as expected. You can assign v@N = 5, but when doing so, you are abusing the syntax a bit. Houdini casts that 5 into a vector {5,5,5}

Did you want something like this?

if (@P.y > 0) {
    v@Cd = set(0,1,0);
}else {
    v@Cd = set(1,0,1);
}

if (v@Cd == set(0,1,0)) {
    v@N = {0,5,0}; // I changed this line
}

 

image.thumb.png.0a99690edf894c465274101e2310e654.png

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