AI follows the player's position and path precisely, but with 1 second delay until he moves again

Hello, I want to make a floating AI that exactly follows where the player was 1 second ago,
if he jumps and lands, the AI will stay in air until player moves again and the AI will “land” too because it copies the exact location of the player

I tried many tutorials, but they just move randomly, instead of following an exact path the player took

what should I try?

  • use a Timer to record last x player locations - 10x per second might be enough
  • if you want the follower to always stay 1s behind, only record the locations if the player is actually moving or only if the player has moved far enough from the previous location
  • add the locations to an array, if you have more than 10, tell the AI to move to location at Index 0, then remove that index
  • for extra precision consider applying coordinates to a spline => slide the follower along a now interpolated path (but this step might be redundant)