Hi all,
I’ve been working in C# with Unity for a while and I found a way to reverse time by collecting every object and the positions of those objects and storing it in an array each frame (up to a certain point so it didn’t slow down the users computer) and I’m wondering how one might achieve this in Blueprint?
It’d need to get all actors (except the player) then store all the information regarding positions and bools, then when the player holds a button it scrolls back through all of that information until the player released the button.
I was thinking along the lines of making an array containing all of the actors in the scene, then either adding to that array or making a new array containing the location of the actors every frame. But only for a set limit of data to prevent slowing down processing and keeping this data together somewhere that can be accessed in reverse order at a key press.
how many different Actors do you Have?
because i would keep an array in every Actor and make a macro which updates the array every tick…
then an interface that checks if it’s called from level Blueprint
In levelblueprint you could keep an array with alle the object that implement this time feature (there is a function called get actors with interface)
then you can send via the interface a message to go back e.g. 25 positions and every actor moves himself to that position…
I guess this would work, but how would you tell each actor to go back through the positions in the array one position at a time to give a smooth “Rewind”?
Could you perhaps make an example? It’d be a bit easier to understand then. I’m still getting the hang of functions, interfaces and macros within blueprints.
you would have to implement a function in your level blueprint…
via interface you implement even more functions like “go one step back”…
and in your level blueprint you could have an array of all the objects with that interface and with a loop you can tell every actor in that array to do something like 1 step back
but to be honest this is way not good enough…
there are many thinks you have to consider…
dynamic arrays are slow and you should use something like a circular buffer(you would have to create one in c++)…
you have to fetch improper time jumps if the time-delta is too big…
i’m not sure about the time dilatation
basically time manipulation can become a very complex thing and you should have somebody with some programming experience and a good knowledge of how ue is handling time
Alright well thanks for the help, I was trying not t have to go into C++ but I guess it’s kind of inevitable until someone makes a more elegant system.
Are those blueprints in the character blueprint? And do I need to use an array for each actor now? I am new to UE but I want to make my game, or at least my character, rewind for X seconds