Remove cut off from mesh slicing
I have procedural mesh slicing set up, but I need a reliable way to remove the cut off segments after a delay. Any help would be appreciated.
asked Oct 27 '16 at 05:19 AM in Blueprint Scripting
I got something going in a test project of mine that may help you out. When I make a slice, I add it and a destroy time for it into arrays. The first time I make a slice, I set a timer to kill slices after a given amount of time. If I make more slices after the timer has been started it's OK, we'll handle them in the timer's callback function.
When that timer expires, it calls a KillSlices function in my actor. It loops through the slice kill times and compares them to the current time.
Any kill times that are not in the future have their slices destroyed and their entries removed from the arrays. Then, if we have slices that still need to be killed in the near future, we reset our timer to call KillSlices again when their time is up. When we've removed all of our slices from our arrays inside of KillSlices, we set a flag so the next time we add a new slice we know to start the kill timer back up again.
There are probably optimizations to be had and some more safety you could build in, but I can cut slices to my hearts content, and they get killed roughly X seconds after being spawned.
answered Nov 02 '16 at 05:49 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here