Make character following another

What's a solid way to have a character stuck to another one?

I have a moving character (say followed) and I want a second one (say follower) to follow the first without chance of getting stuck into obstacles.

I thought that I could save every delta velocity vector of the followed and having the follower consuming one each frame after it reached its target's starting position.

More to say, dynamic obstacles could be an issue.

Since this sounds to me like a common topic (despite the fact that I'm having difficulties in finding answers), is there anyone who could enlighten me on a proper way of facing the issue?

Edit:

Since I'd like to describe something more like to an edge case of a pathfinding algorithm, consider the following:

• follower should always be at a fixed position related to followed
• follower must not necessarily interact with the environment the way followed does
• If I understand this correctly, you're not looking for the follower to retrace the followed character's path, rather you want them to always be at a fixed offset? If so, what's preventing you from just treating them as one object? Sep 26, 2019 at 11:11
• @RutherRendommeleigh that could make sense but has a few issues. depending on the engine, you could have to override several behaviors like mirroring position updates, rotations, and so on. Sep 26, 2019 at 13:27

It sounds like you want one object to be "towed" behind the other, as though it were tethered to it by a free-swinging, rigid bar of a fixed length, and ignoring any obstacles along the way.

Instead of pathfinding around obstacles, or copying the leader's path exactly, this object will dead-reckon toward the leader, cutting corners when the leader turns, to follow the shortest path that maintains its fixed following distance. If the leader starts moving toward the follower, the follower will back up as though pushed by this tow rod, until the bar is nudged far enough to the left or right that it can swing around the leader again and resume the chase from the other side.

If that description matches your desired behaviour, then we can do this with a very simple trick:

// Get the vector pointing from the leader to the follower.
Vector offset = follower.position - leader.position;

// Scale this vector so that it's exactly as long as our desired distance.
offset = offset * followDistance / Length(offset);

// Snap the follower to the leader's position, shifted by this offset.