Create a link between GameObjects so that when the front one moves the rest follow it's path (2D)
Very new to all this and just trying to make a Snake style game but with a slight twist of it being fully controllable on the X and Y rather than just pointing it in a direction on a grid.
I have linked all game objects with a Distance Joint 2D component and each one has a rigidbody 2d and box collider 2d.
I have set written a script so that the front of the 'snake' moves. This script is applied to the front gameObject but none of the others follow it even though it is linked with a distance joint 2D. When I make the movable head collide with something else in the scene the rest of the body then tries moving towards it. I don't really understand why this is happening.
I essentially just want the player to be able to move the front of the snake so that the rest of it follows while being made up of individual segments.
Here is an image of the segmented 'snake': https://imgur.com/a/SNFCmBZ
Thanks