How to dynamically place nav link proxies?

I am trying to use nav link proxies and I search for a way to place them without manually placing them in the level. So I want to put the nav link proxy in a blueprint and any time I place the blueprint it’s configured correctly. If you have many same objects which all need to use nav link proxies this makes sense I guess. And I also want to spawn these blueprints dynamically while the game runs.

But how can I do this? I actually always thought there would be something like a “nav link proxy component”, same as there is a “nav modifier component”, but I can’t find any “nav link proxy component” and I also can’t find any other way to spawn one from blueprint. Where is it? I really need it, I just never thought about this being a problem before.

I just noticed I can create an actor based on nav link proxy, so I could add this actor as a child actor component to my blueprint, but then the problem is I can’t set the left and right point in the viewport because it’s a child actor component and not a nav link proxy. Now I can get the real nav link proxy actor in blueprint from the child actor component, but then the problem is that there is no way to define the left and right point!

After clicking on a nav link proxy in the level I see that there seems to be an array of “PointLink” structs (?) inside where I can set the points, but I can’t get and set these struct from a blueprint which inherits from “nav link proxy”. Why?

1 Like

Same problem! Looking for a way to let AI drop down off high ledges without placing a bazillion proxies. Seems like it should be easy.

No answer? Maybe @MieszkoZ knows something about this?

I have the same problem too. Any ideas?

I don’t think there is a way to do it purely in Blueprint, as the positions of the links (point or smart) are not exposed.

You would have to create a small C++ helper class to do just that.

  1. Create a C++ Class based on the NavLinkComponent. You’ll need to tick “Show All Classes”. Call it BlueprintableNavLinkComponent.

  2. Open the .h file and find the line with UCLASS(), and add meta = (BlueprintSpawnableComponent) in between the brackets, so it looks like: UCLASS(meta = (BlueprintSpawnableComponent))

  3. Add the following two lines of code under the GENERATED_BODY() line:

    UFUNCTION(BlueprintCallable)

    void SetupLink(FVector Left, FVector Right, ENavLinkDirection::Type Direction);

  4. In the source file (BlueprintableNavLinkComponent.cpp), add the following code:

    void UBlueprintableNavLinkComponent::SetupLink(FVector Left, FVector Right, ENavLinkDirection::Type Direction)
    {
    this->Links[0].Left = Left;
    this->Links[0].Right = Right;
    this->Links[0].Direction = Direction;
    }

For more see this blog post: Navigation Modifiers and Links in UE4 — Vikram Codes

1 Like

Thanks for the shout-out! Let me know if you have questions @OP!

Wanted to share my approach to this. It’s not as amazing as I want ( mostly due to needing to press a button in the editor to generate / re-generate the links ), but it works pretty well and our world builders are AMPed to not have to place these things automatically.

I made a C++ class that extends NavLinkProxy. Then exposed an event to the Editor as a button, when clicked, it gathers all the nav in the world and executes an algorithm to place Nav Links on any edges that aren’t shared with other Nav Mesh Polys.

I was worried I would never find a solution to this, but then this came together in a day or two only. :slight_smile: Still has some iteration to do but happy with the result so far!:

Is it possible that you share (part of) your code?