I am new to using AI Perception and Behavior Trees in Unreal, but I’ve noticed some significant issues with the process of aborting a MoveTo task and immediately starting a new one. The quintessential, simple enemy AI behavior is to give chase to a player when they’re in view, but then transition into moving toward their “last seen location” once the player leaves view. As far as I understand, this necessitates aborting and triggering a new MoveTo, since the target types are different (actor vs vector location).
So far I’ve noticed at least two issues with this process.
The first is that the enemy character’s acceleration is reset. It may be subtle in some cases depending on the set acceleration values and camera angles, but the resulting motion from the transition is not smooth, which can obviously be undesirable. Even with quick acceleration values, from a top-down perspective there’s a visible “bump” in the enemy motion when the transition is made.
The second and perhaps more serious thing is that when Set Control Rotation from Pawn Orientation is enabled, as far as I have been able to tell, this fights with the MoveTo’s and can lead to rapid oscillations in some cases. It seems that when a MoveTo is aborted, even when a new one is immediately triggered in the Behavior Tree, Set Control Rotation from Pawn Orientation tries to take control of the AIController’s rotation for one frame. And when the enemy character’s pawn rotation doesn’t match the controller rotation the MoveTo is trying to set, rapidly bouncing to different rotations can move the target actor in and out of a seen state, which can cause MoveTo’s to be aborted and retriggered again, creating a feedback loop. This is what I think is happening.
So to summarize, aborting a MoveTo and immediately triggering a new one causes the pawn’s acceleration to reset, and also causes Set Control Rotation from Pawn Orientation to briefly try to grab the AIController’s rotation when it shouldn’t.
Am I going about this the wrong way, or have I missed anything important?