Heya Fabrice,
As Rama mentions, you’re looking for Play Rate. In the animation Blueprint for a skeletal mesh, animation sequences and blendspaces have support for negative Play Rate. In the image below, I’ve created a variable called Play Rate, and exposed the Play Rate property as a pin on the animation sequence and blendspace nodes.
I’m not a familiar with the code side, but a quick search shows that PlayRate, GetPlayRate, SetPlayRate exist in many animation classes.
As for reversing time, entire games build their mechanics around reversing time (and just reversing it), and there’s much to consider, just off the top of my head:
- AI logic that can handle being reversed and acting the same given the same variables
- Player transform recording
- Key event logging (ex firing a rocket)
- Logging where a that rocket was fired from
- Remembering a rocket exploded in the time frame that allows rewinding, re-creating that destroyed asset
- VFX/SFX reversal
- Giving the player back ammo upon reversal (or any other expended resource)
- Resurrecting and enabling controllers for any killed AI (or simply preventing the controllers from being destroyed until such a point that there’s no way they could be brought back, ex: a “dead, but not really dead” state)
- Setting the newly resurrected AI’s state to match what they where (assuming you destroy them)
- Removing anything from the player he/she may have picked up (or any resource gained)
- Putting said items back into the world (think about an RTS game with trees you cut down, or an FPS where you pick up keys)
- Re-locking any container/doors the player may have unlocked (or any other state based object)
- Physics Simulation… not even sure where to start with that
- And I’m sure hundreds of other things that get more intense when you consider many systems are built to assume time progressing forward
Much of this is just state switching, which you could record, but you have to deal with the fact that you are using system resources to do all of this, so some other portion of the game will not be as performant or will have to be scaled back.
