Can anybody suggest me how to make the Gears of war or Call of duty like player’s death? i.e, when players dies they show the rewind of how the player dies.
A death cam?
Pretty sure I saw a post on this at some point.
From memory, UT4 has some basic code for this kind of thing too.
Perhaps that would be a good place to start looking?
The way I’d handle it is with a struct to hold the transform for the object, the angular velocity, and the linear velocity.
As game play happens you add the struct values into an array.
When you want to “replay” the death, all you have to do is rewind the array and play through it again.
You can easily transform this into a component that you can add to objects as well - then anything will be “kept track of” (don’t overdo it. it will probably use the On Tick even on everything to memorize positions each tick. this can immediately become costly).
Fairly simple in concept. a bit hard to do in the end.
I would probably choose a hard limit for the array size. even though it’s just data so you can store a tonne of it before it becomes an issue.
Either way, once the data is stored and you can go through it you can even rewind - then play it again for an ultimate “you suck and must watch yourself fail again” effect.