Jump to content
Sign in to follow this  
jackassol

If / Else group - VEX

Recommended Posts

I'd like to know the best way to use If Else type statements in Vex code.
 

What I wanted to achieve:

if( in the group name "inside") {
    @stiffness = 1;
}

else ( not in side the group name "inside") {
    @stiffness = 1000;
}

 

What's the correct vex code for this function Vex?

 

I don't get this working.

 

best

 

jack

 

 

 

 

Share this post


Link to post
Share on other sites

while there are functions like inprimgroup() or inpointgroup(), whenever possible I like to use the shorthand @group_groupname syntax. So if you run over points and are looking for a pointgroup then your code would be

if(@group_inside)
{
  	f@stiffness = 1;
}
else
{
  	f@stiffness = 1000;
}

 

Edited by 3dome
  • Like 1

Share this post


Link to post
Share on other sites

Hi Jack,

This should work:

float @stiffness;
int @group_inside;

if(@group_inside==1) {
    @stiffness = 1;
}
else {
    @stiffness = 1000;
}

or in short:

@stiffness = @group_inside==1?1:1000;

Cheers,

Luca

 

Edited by LucaScheller
  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×