Player Follow Delay
Hi there!
So I'm planning on making a speed effect for my character anytime they hit a speed block. This animation features a version of that character (let's call him DELAY) repeating the same motion as the original except it has a delay. Here's a picture of the ideal motion.
The problem I'm having is that DELAY doesn't repeat the same action as my character, but instead jumps to where the character is after the delay, even when they are moving. I want repeated motion but starting at different times, with the start and end position always being the same
Here's the code I used so far
public Transform player;
public float delay;
// Start is called before the first frame update
void Start()
{
player = GameObject.FindGameObjectWithTag("Player").GetComponent<Transform>();
}
// Update is called once per frame
void FixedUpdate()
{
StartCoroutine(TimeDelay());
}
public IEnumerator TimeDelay()
{
yield return new WaitForSeconds(delay);
transform.position = player.position;
}
Your answer
Follow this Question
Related Questions
How I can make camera rotate smoothly followed object? 2 Answers
Object Coordinates with timecode 0 Answers
Delaying between statements 3 Answers
Delay between bone animation and cache animation 0 Answers
How do I spawn a List of Objects so that there is a delay after each object that spawned? 0 Answers