circa23 Posted April 24, 2018 Share Posted April 24, 2018 Hi guys I've been fumbling around with this for ages and I cant figure out what to do. I have a bunch of points scattered over a grid with a solver running through them (exactly like the infection system that simon holemadel uses) changing an attribute named 'infect'. Not infected = 0 infected =1. What I want to do is fade the color of each point from black to white over a specified amount of time from when each point became infected. I'm falling at the first hurdle of storing the time at which an individual point was infected in VEX. Im using an attribute wrangle and I think I'm on the right track with 'setdetailattrib' function, however I cant get it to take. here's the Vex code I have been using: float @timestart; if (@infect == 1) { setdetailattrib(0,"timestart",@Time,"set"); } and I have uploaded a screen shot and the scene file. If anyone can shed some light on this it would be much appreciated. Cheers Al Set_Time_Attrib_on_points.hip Quote Link to comment Share on other sites More sharing options...
woodenduck Posted April 24, 2018 Share Posted April 24, 2018 If all you want to do is fade the colour over time, I would just multiply @Cd by a value less than 1 each frame. Otherwise you will need to compare the attribute value on the current frame with the previous frame. If the value on the current frame is 1 and the previous frame is 0, then you can store @Frame/@Time in a variable as the infection frame. Quote Link to comment Share on other sites More sharing options...
ThomasPara Posted April 24, 2018 Share Posted April 24, 2018 The easiest way is to accumulate an "age" attribute per point, starting at the point where they get infected. You can do this by simply saying @age++; Another issue you have is that all your points are looking for infection, while it should be the other way around. Its lighter to check for non-infected points around the infectors. If you put millions of points into your infection-system it will get pretty slow. Ive attached a simple file where i try to show how it can be done lighter. basic_creep_01.hiplc 1 Quote Link to comment Share on other sites More sharing options...
circa23 Posted April 27, 2018 Author Share Posted April 27, 2018 @woodenduck Cheers dude, yeah that sounds exactly what I'm after, just not sure how to format it in VEX. @ThomasPara Dude this is awesome!!! exactly what i wanted to do! Im still really new to VEX and coding so I need to pick all your code apart to see whats going on. Thanks again!!! 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.