Hi! I’m currently trying to implement simple navigation into my game using C++ but I can’t seem to get the acceptance radius to work. I’m trying to make a character run after me and stop when they’re close enough.
Here’s the code for the entire function (inside of a custom AIController):
void ALocalAIControllerNPC::MoveToTarget()
{
if (NavSystem != nullptr)
{
if (GetPawn() != nullptr)
{
if (TargetActor != nullptr)
{
UNavigationPath* PathToActor = NavSystem->FindPathToActorSynchronously(this,GetPawn()->GetActorLocation(), TargetActor);
FAIMoveRequest NewMoveRequest;
NewMoveRequest.SetAcceptanceRadius(500);
GetPathFollowingComponent()->RequestMove(NewMoveRequest, PathToActor->GetPath());
}
}
}
}
It doesn’t matter what I put into SetAcceptanceRadius(), the character still runs into me and keep going without stopping. Why is this? I looked into the RequestMove() function and found this line:
const float UseAcceptanceRadius = (RequestData.GetAcceptanceRadius() == UPathFollowingComponent::DefaultAcceptanceRadius) ? MyDefaultAcceptanceRadius : RequestData.GetAcceptanceRadius();
I’m not sure exactly how to parse this. Can someone please explain this line?
If there’s any additional information needed, feel free to ask.