Jump to content

timer in vex, or time when condition is met.


Recommended Posts

Hi, I am basically at lost trying to figure out how to record the time when a certain condition is met in a simulation. I am using pop wrangle in this case.

The basic problem is that once I set the value to @Time. the attribute get linked to the global time attribute, basically the clock is still running. I know is pretty logical but presents me with a problem... how can I record the exact time when a condition is met.

You can take a look at the file for an example and if you see the attributes in the geometry spreadsheet you will see how state and time all start appropriately but time_start remains running even after state changes.:wacko:

i@state = 0;
f@time_start = 0;
if (dist < outRadius && @state == 0 )
{
    @time_start = @Time;
    @state = 1;
}

 

timer.hiplc

Edited by Butachan
Link to comment
Share on other sites

Hi

You are resetting the particles attributes i@state and f@time_start on every frame, so your test is always true. :) Try to run it with these modifications.

//v@Cd = set (1,1,1);
//int state = 0;
//f@time_start = 0;
float origin = 0;
float dist = float (@P.y) - origin; 

if (dist > 2  && @state == 0 )
{
    @time_start = @Time;
    @Cd = set (1,0,0);
    @state = 1;    
}

 

-b

  • Like 4
Link to comment
Share on other sites

OMG thank you bonsak...I can't believe I was stuck in this, kind of obsessively actually, this was of great help!!!...

Basically this is one of those basic functions I will probably use over and over again in the future, so I couldn't stop thinking about it all day. I guess sometimes is better to sit back right?

So thank you man.

 

Edited by Butachan
  • Like 1
Link to comment
Share on other sites

Attrib Fade is also a great way to get some procedural, time-based attribute modifications. I like to use it to fade from simulation impacts or sop solver accumulations.

It's all VOPs/VEX, so you could pick it apart if need be, but by itself, Attrib Fade is pretty powerful!

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