Jump to content
ikoon

update variable inside custom function (vex)

Recommended Posts

Please, in vex, is it possible to define a custom function, which will update the variable, without classic a = function(a) assignment?

For example:

f@big = 1.5;
clamp01(f@big); // function clamps between 0 and 1
f@result = f@big; // result is 1.0

 

I found nothing, but I am newbie, sorry. Is this technique called "pass by reference", or also "pass a pointer"? Probably not possible in vex?

Share this post


Link to post
Share on other sites

I ikoon,

sure you can, here's examples :

vector pos = @P;
void cl(vector pos)
{
    pos.y = 0;
}
cl(@P);
void clamp01(float cl)
{
    cl = clamp(cl,0,1);    
}

f@big = 1.5;
clamp01(@big); // function clamps @big between 0 and 1
f@result = @big; // paste @big to @result

 

Documentation about it

Hope it help,

Gab.

 

 

Edited by Nache
misspelled name
  • Thanks 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

×