Jump to content

incrementing float attribute over time


ekan de

Recommended Posts

Hey all, this is probably a simple question but cant really figure it out.

I have a grid, and a sphere that i am animating over the grid. This transfers a mask attribute with the mask from geometry node.

I would like to take this mask attribute and use it as a trigger for playing alembics.

Using the solver node for comparing and storing the mask attribute so it stays on 1 if the sphere has moved over a point.

I create a attribute named trigger. Say if mask is > 0.5 the trigger attribute is 1.

When trigger attribute is 1 i need to start incrementing another attribute named animation from 0 and upwards over time.

 

How would i write this in vex so i can plug it into the primintrinsics of alembics that i copy on the grid?

Thx!

 

Link to comment
Share on other sites

I am kinda newbie on vex and how to think it thru, how do i store the frame per point? or well, let me put it this way, how do i combine that with the mask from geometry so the frame doesnt go to nothing after the trigger happens?

 

Link to comment
Share on other sites

Trigger should be created before the solver and set to zero. In the solver triggerr is only set to one if mask is one and trigger zero like:

if(@mask > 0.5 && @trigger == 0){

@trigger=1;

@triggerframe = @Frame;

}

Hope this helps

Link to comment
Share on other sites

Thank you for your suggestions. I still dont get it to work as i want.

Probably me that is thinking about this all wrong.

 

1. is it possible with vex only to increment a number over time? without the solver at all?

2. My thougts are, to have a trigger attribute, when this attribute is over 0 a new attribute say startanimation is starting to count. This attribute needs to start at 0, be a float and count upwards over time. I

3. i can get the startanimation to correspond to the framenumber but this wont make it start from 0.

Sorry for being a pain in the ass but i dont really get the concepts yet.

Link to comment
Share on other sites

I got a solution working now.

i used the solver node and in that a attributewrangle with this code:

//get mask value from previous frame

f@prevmask = pointattrib(1,"mask",@ptnum,0);
if (@mask < @prevmask)
{
//set mask value to mask value from previous frame
@mask = @prevmask;
}

//increment abcframe over time from trigger

@newabcframe = point(1,"newabcframe",@ptnum);
float fps = 25;
if(@mask > 0){
@newabcframe += 1/fps;
}

Then i put another attribute wrangle after the copy to points where i just set the primintrinsics abcframe to the newabcframe.

 

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