Currently I am learning UE’s BehaviourTree and stumbled uppon the “DefaultFocus”-Service. I hoped to use it as an alternative for a “LockOn”-System, so the AI moves while looking at a certain, moving target (e.g. Player) and doing a strafe-move while moving by deactivating “OrientRotationToMovement” in the AI’s BP.
But what happens is the followig:
- The AI moves without strafe to a given location with MoveTo, always looking towards the target location
- After reaching that point a wait task gets triggered, the AI does look permanently towards the target player through “DefaultFocus”-Service in this timespan
- After the Wait-Task is over, the sequence restarts. A new location is calculated and the MoveTo-Task triggers, leading the AI to lose its focus again without any strafe!
I printed out the focused object in the EventTick of the AI-Controller to see what happens. And as described above, when the AI moves it loses the focus to the target until its returns into a waiting-task:
This is my BT, its a simple one since i am just testing this service.
My MoveTo-Task also has “Allow Strafe” activated but that doesn’t seem to affect each other:
That is why I deactivated “OrientRotationToMovement” in the AI’s BP additionally (in a custom makro):
So my questions are, why does that happen and can I prevent it?
Can I even Use “DefaultFocus”-Service as a LockOn-Alternative or is the purpose of the service, the approach to it’s usage a totaly different one? If so, how to use it properly?