I wasn’t able to fit my question into the header and I don’t think my english is good enough to explain it but I will try. I was often seeing racing games where you try to beat your highest score, and your previous gameplay was shown on the screen like a transparent AI car moving next to you. I really wonder how to achive something like that. I’m not thinking doing something like that but I can’t stop thinking about how to achive that.
Save data in a struct with pos and rot of the car you want to save. When saving it, save the time also so that when it’s replayed, it’ll be replayed exactly the same times as the normal version. I’d use a fixed time scale.
-Save the pos, rot and the time spend since the start on a struct (in FixedUpdate?) ,
-When displaying the data again, starting from the first data on the struct, check if the time spend since the start has reached the current records time, if so, set the pos and rot of the car to the current datas values and get the next data(in FixedUpdate again?).
Putting all together so maybe someone can use this.
no a fixed Time Scale not Fixed Update, fixed update, updates every 3 frames, which isn’t bad, but it may cause jitteryness. (Unless you’re using forces) then it may be applicable, but I’d ask someone more experienced with that one lol.
It’s called a ghost car. (To ghost your previous drive).
As others have said, store the position and rotation of your vehicle as you race in a struct of some sort in Fixedupdate.
Then when you start the next race, create an additional vehicle that reads, at every FixedUpdate, what it’s position and rotation were at that FixedUpdate increment.
You can use any Transparent shader for your ghost vehicle.
It does, but matching the FixedUpdate interval to the target frame time should also see benefits when driving the car. I was offering one possible solution, but it will have a cost like most options will. Projects vary, so it may or may not be practical in any individual case.