# How to make trail effect?

• I’m wondering how to make objects follow each other with the function to add and subtract objects(making a trail like slither.io)

• For each time an object moves another object can move the same amount of units up, down, left, or right?

• Yeah but how do I make it so I can add more in game.

• What do you mean?

Just put all the regular behaviors, and when you do something to move the object or set a velocity or whatever, tag the object and the objects that are following it to move together.

• @GameCRAZY that wouldn't make a trail, they'd all move the same way. The easiest way I think is to use an array the length of the trail, every time the main object moves add its position to the front of the array and delete the last one. Start the array with the starting positions of the trail. Whenever you move, each part of the trail moves to the relevant part of the array.

• Pivot Joints.

Head (first circle) has a pivot joint some percentage from its centre towards the direction of the tail. Place the pivot joint here, attach the tail circle at this point, to its centre. Each subsequent tail section attaches to its "parent" at a point on the parent the same distance from the centre that was used on the head, in the opposite direction to that of the current movement.

Some maths required to figure out where that is, math that is far beyond me.

• Here's an image describing the offset of the initial anchor point on the head, each subsequent tail section has its own anchor point moved the same distance in the corresponding inverse direction of travel: