Download

How to dynamically spawn NavLinkProxy and make it works?

I want to let my AI character jump over the obstrution but not to find anotherway.I’ve tried to drag NavLinkProxy from left and place it in the level.Then the AI jumps over the obstruction.So I try to spawn them by C++ code.I don’t want to place hundreds of LinkProxy myself.

I use C++ code below to spawn NavLinkProxy :
1 ANavLinkProxy* NewLink = GetWorld()->SpawnActor<ANavLinkProxy>(ANavLinkProxy::StaticClass());
2 NewLink->SetActorLocation(this->GetActorLocation());
3 for (int32 i = 0; i < LinkPoints.Num(); i++) // TArray<FNavigationLink> LinkPoints
4 {
5 LinkPoints*.Left += this->GetActorLocation();
6 LinkPoints*.Right += this->GetActorLocation();
7 }
8 NewLink->PointLinks = LinkPoints;

The NavLinkProxy is successfully spawned on world.But the AI character still bypass the obstruction.
If you’ve got any solutions or good ideas,please tell me at once.Thanks a lot! :slight_smile: