Hey there, folks! I’ve currently got an AI character to home in on my character’s location and go there at the push of a button. So far, looking great! However, I’d like to get it to the point where the AI character will walk next to the player, following alongside them wherever they go. How would you recommend I go about doing this?
Just to clarify, I’d like to have the AI stay on the player’s left, or right side. When the player turns, the AI will turn with him, remaining at the player’s side.
Thanks for the response! I’ll consider that, but I’ll wait to see what someone with some AI experience has to say as well before I try scripting blindly!
What I would do is:
Spawn a target point and attach it to the player character then add a local offset to it.
Then just tell the AI to move to that actor.
Maybe you could make a Blueprint with Target points only. You attach this “formation” to your player blueprint.
then each AI chooses one of the target points and tries to walk towards it.
the formation rotates with the player, so this should achieve your desired behaviour. haven’t tested it though. if it works, let us know
if it works, you could make several different formations: diamond, V formation, echelon, etc… and let the player choose one
If you place a point near your player, the whole thing would be limited to this point.
You need to find a “random” point around your player in a maximum distance away from him. So as long as you don’t move away from that
point, the AI will stay and if you are too far away, you just search for a new point (there is an actual node for that using the nav mesh) and
let the AI move to it.