Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Repathing no longer works on vector targets

ANavigationData::RequestRePath no longer works correctly if the target is a FVector rather than an AActor. (i.e. it was set up via FAIMoveRequest::SetGoalLocation rather than FAIMoveRequest::SetGoalActor, before being passed to AAIController->MoveTo).

It appears that was a result of this change: https://github.com/EpicGames/UnrealEngine/commit/48331caa30db5ac914681a54cab4ff5753786fde#diff-15859a9cc76ea497ddf16d386bc55faa

That change in NavigationData.cpp means that it's no longer sufficient to have bUpdateEndPointOnRepath set to true to force a repath; GetGoalActor() must return a non-null value, which won't happen when the target is an FVector.

The workaround involves forcing a manual update of the EndLocation for the repath, and will look a bit like this, before any relevant call to RequestRepath:

 FPathFindingQueryData PathQueryData = Path->GetQueryData();
 PathQueryData.EndLocation = YourDesiredNewDestinationHere;

(Get the underlying FNavigationPath from the UPathFollowingComponent for the above).

Product Version: UE 4.14
more ▼

asked Feb 09 '17 at 10:21 AM in Bug Reports

avatar image

6 1 2

avatar image Sean L ♦♦ STAFF Feb 09 '17 at 03:14 PM

Hey Kylotan,

Thanks for the report. Would you mind providing a functional example of this issue occurring?

Could you provide the code that you are using so that I can take a closer look at your setup?

avatar image Kylotan Feb 09 '17 at 03:25 PM

Unfortunately I can't share the code publicly. But all the important details are above - the code simply won't recalculate EndLocation if there's no GoalActor, so it can't work.

avatar image Sean L ♦♦ STAFF Feb 09 '17 at 08:10 PM

Ah, okay, I overlooked it earlier but I see what you're referring to now.

Just to clarify, is this the code that you are referring to in NavigationData.cpp?

 if (PathToRecalculate->ShouldUpdateEndPointOnRepath() && (PathToRecalculate->GetGoalActor() != nullptr))
         const FVector NewEndLocation = PathToRecalculate->GetGoalLocation();
         if (FAISystem::IsValidLocation(NewEndLocation))
             EndLocation = NewEndLocation;

Also, you state that it no longer works correctly. Which version were you working in when you experienced different behavior?


avatar image Kylotan Feb 10 '17 at 09:45 AM

Yes, that is the change in question, specifically the addition to the if statement on the first line. I don't know the exact version we were on when behaviour was different but it would have been a year ago or so.

avatar image Sean L ♦♦ STAFF Feb 10 '17 at 02:30 PM

Great, thanks for the clarification. I've reached out to our developers and I'll respond as soon as I hear back with a solution.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I'm not sure I understand your issue. Auto-repathing is done when underlying navmesh changes, or when the move goal moves. Vectors (as move goals) don't normally move on their own, so if you want to reuse path object by changing path's goal location and repathing you'll have to do it on our own. Your workaround is actually a proper way of implementing it.



more ▼

answered Feb 10 '17 at 03:17 PM

avatar image

MieszkoZ STAFF
7.3k 223 57 412

avatar image Kylotan Feb 10 '17 at 03:38 PM

In our case, the goal has moved, just that there's no way to represent that without making it into an actor, which we don't want to do. We're happy with using the workaround, but it feels wrong that ShouldUpdateEndPointOnRepath() can be true and yet nothing happens, or that the constructor will fix up EndLocation for us in one circumstance (actors) and not the other (vectors), and that GetGoalLocation() is out of sync with EndLocation in the vector case.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question