Best way to record/save race car runs

So, I have a racing game mostly done. Now I want to be able to record the car’s run so that I can play it back. I’m NOT trying to record video, or the screen, or the game, I want to record the car (GameObject) so that when the next racer races, they can race against the previous run. So it will be a completely new game, but a bot racer (computer controlled gameobject) will replicate the previous or best run.

What’s the best way to do this? Record the position and rotation with AnimationCurves, then read those curves and set the position/rotation later? Create a custom asset that stores the position and rotation and then uses them to set the bot’s later? Wouldn’t that be a lot of data if captured each frame? Maybe just store rotation and speed, and let it replay those to establish position?

Maybe there’s an asset out there that can do this, but most of what I saw were scene based, or didn’t save. I just want to track the car’s position and rotation, and use that data later. Suggestions?

There are generally two ways of doing this…

The first is to store position and rotation for every frame. At the end of the race (or if the amount of data exceeds some threshold), you then process that data into a series of curves which can be saved with a much smaller footprint.

The second is to store input. Store when it accelerates, decelerates, and turns. That will have a much smaller footprint initially, but if it’s not perfect, any error can get exponentially worse very quickly.