ekan de Posted November 30, 2022 Share Posted November 30, 2022 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! Quote Link to comment Share on other sites More sharing options...
fex Posted November 30, 2022 Share Posted November 30, 2022 Just store the frame when trigger is 1 and then do after the solver something like: fit(@Frame, @triggerframe, @triggerframe+100, 0,100) 1 Quote Link to comment Share on other sites More sharing options...
ekan de Posted November 30, 2022 Author Share Posted November 30, 2022 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? Quote Link to comment Share on other sites More sharing options...
fex Posted December 1, 2022 Share Posted December 1, 2022 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 Quote Link to comment Share on other sites More sharing options...
Ziyad Posted December 3, 2022 Share Posted December 3, 2022 Hi, I've made a quick setup similar to what Felix suggested. Hope it helps increment_anim_value.hipnc Quote Link to comment Share on other sites More sharing options...
ekan de Posted December 7, 2022 Author Share Posted December 7, 2022 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. Quote Link to comment Share on other sites More sharing options...
ekan de Posted December 7, 2022 Author Share Posted December 7, 2022 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.