Hey all, I have a 2D game with enemy pawns that I have set up a behavior tree, blackboard and ai controller for. It all works perfectly fine except in my behavior tree I have a select node then a move to the player object node which doesn’t work at all. I think it might be because of the 2D top down layout but I’m not sure. The player object is defined in my blackboard and takes my BP_Player so there is no problems with that I don’t think and there is also a nav mesh bounds directly beneath my enemy . Can anyone help me out please I’ve been stuck on it for days, thank you
Here are the screenshots of the game and the behavior tree:
does your enemy class inherit from a pawn or from a character? if you have built a custom class for your enemy i would just take a look at which movement component the pawn uses as this may stop your pawn from moving properly depending on the movement you want.
My enemy class inherits from a pawn and has a pawn movement component but I’m not sure what I should do to the movement component to help with the problem
Thanks for the idea and I’ve just fixed it so the Player is not null now by casting to the player then doing BlackboardComponent->SetValueAsObject(“PlayerObj”, Player); in the code but the enemies still won’t move one bit.
Your Self Actor Node now appears to not be filled. This should be filled automatically when you play by the BB. Just to confirm have you set up the pawn with an AIController e.g
-open pawn
go to class defaults
scroll to AiController
select your AI controller from drop-down
set AI possess pawn that are spawned/placed in world
or is the controller spawning elsewhere?
if you have done this then check If the radius of your pawn bigger than 35? if so check your navigation agent setting in project settings.
the final thing to check as i mentioned previously is the movement component. I have had trouble with Pawn Movement components before as i think they try to drive the character using RequestPathMove().
try re-parenting your movement component to the NavMovementComponent and overriding the RequestDirectMove() function instead.
if you are not working in C++ i would recommend that you only use Characters as a parent for you Enemy AI and use the CharacterMovementComponent instead.
Sorry it took me some time to reply I was on a break over Christmas.
All my enemies are possessed by the AI Controller and I have now filled my SelfActor to be the current enemy that the AI Controller is possessing. And it still isn’t working and as for re-parenting the Pawn Movement Component, I have never tried this before so how would I go about re-parenting it to the NavMovementComponent. I feel like the answer to my enemies not moving is very simple however but I’m still stuck.
If moveto position y value is not correct, for example too high or too low than floor, moveto will fail. You could print the y value to see that.
Another reason, maybe the Root Motion Mode of character 's animation blueprint is Root Motion from Everything, change this to Root Motion From Montages Only.
Hey, I am also having a similar issue, all of the AI MoveTo functions stopped working all of a sudden, I have a nav mesh and my AI Controller is reading the correct pawn it is possessing, however I keep getting this error when the Behavior Tree tells the A.I to move.
Notice that the floor mesh requires a simple collision for the navmesh generation. Did not saw this mentioned anywhere and very confusing when there is the only pointer from the AiMoveTo node enum for aborted, which is connected to collision issues.
To check if the navmesh is active / floor has collision press P.