I’m trying to get my player character to automatically walk to a certain spot after a specific input and with the “Simple Move To” nodes, it never actually properly reaches the target location. I’m assuming that’s simply because those nodes don’t let me specify the acceptance radius. I’ve been reading some stuff on the answerhub about having an AI controller somehow working in conjunction with the player controller to control my player character, but none of the stuff has explained how to actually get that working in a very clear way. So, how exactly am I supposed to set this up?
For AI I would recommend using Behavior Trees. You may use Move To task that allows you to specify “Acceptable Radius”.
You can watch this video to get an idea of how to use it.
That is not at all what I’m asking. Did you read my actual comment or just the title?
In most cases, it’s probably best to avoid trying to mix AI Controller and Player Controller. Just stick with one of these.
You basically have two options: First is to control it “directly” - you can find an example of this in the TopDown template. It has click-and-move behavior implemented. This type of behavior is great when you only control one character.
It looks like this: Player Controller (posses) Character
Second option is to assign an AI Controller. You can still assign movement commands, but you do it “in-directly”. Implement the movement logic on the Player Character (like Move(Vector)) and then call this function from your actual “Player Controller”. In this case your Player Controller does not control anything directly but acts an “interface” (not to be confused with BP Interfaces). This is the type of behavior you would implement for most games where you control more than one character at the same time.
It looks like this: Player Controller (get reference to) [Character ↔ AI Controller]
Which of the modes are you trying to implement?
I wanted to do the second thing, but I realized that it’s actually way too complicated for my simple needs, so I just ended up using the “Simple Move To” nodes and instead just adjusted the target location to make sure the player actually fully goes to it.
I am actually trying to do the second way, too, because I like how the AI navigation works, but I can’t seem to get the hang of it. Does anyone have a good example?
I managed to make it work using a really hacky way.
I created a CharacterBP, an AICharacterBP copy pasted from the Character of the Top Down template. Then on event begin play of the Character, I attach its Camera to the AICharacter. Then, when I ask for a move, I order my AICharacter to move using AI move to.
It works but it’s far from ideal since you loose every benefit of using a player character and it’s a mess to implement in an already existing project.
I managed to make it work using a really hacky way.
I created a CharacterBP and an AICharacterBP (copy pasted from the Character of the Top Down template). Then on event begin play of the Character, I attach its Camera to the AICharacter. Then, when I ask for a move on the Controller, I order my AICharacter to move using AI move to (instead of the Character).
It works but it’s far from ideal since you loose every benefit of using a player character and it’s a mess to implement in an already existing project.
yep, a simple move to and use “get player controller” as the controller input does the job, you just need to disable the movement logic