Making a gameobject follow a player closely

So i’m trying to make a snake clone for practice and now i’m stuck at trying to make the tail or body follow the head.
so this part here works fine

 //reference to head 
 head = GameObject.FindGameObjectWithTag("Player").GetComponent();
 
//instantiate body below the head
body = Instantiate(bodySprite, new Vector2(head.position.x,head.position.y-0.5f), Quaternion.identity);

But when I add this part on the update method the body just go below the head so you can’t see it

body.transform.position =  Vector2.Lerp(transform.position,head.position,300*Time.deltaTime);

There’s probably a better way of doing this and I would really appreciate it if you let me know.

Hi @shakeearth16, here’s the problem: when you create the body, you offset it from the head. But when you LERP you don’t use the same offset. The easiest way to fix your problem is to get the offset between head and body when you instantiate.

  // instantiate first then:
  Vector2 bodyOffset =  body.transform.position  - head.position  ; 

  // then when you LERP, use this as the LERP TO point:
   head.positon + bodyOffset;