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"

FindPathSync Finds only 2 points

I am trying to find the turn points of an actor's path:

alt text

I use MoveToLocation function to move my actor to it's target by avoiding obstacles. I have been wondering how can I get the turn points of the path. I am using FindPathSync to find the actor's path and find all the vectors which build it:

                 FPathFindingQuery Query;
                 FAIMoveRequest MoveReq(AVikingKingPlayerController::mouseHit.ImpactPoint);
                 bool bValidQuery = ((AAIController*)GetController())->PreparePathfinding(MoveReq, Query);
                 if (bValidQuery)
                     const FNavAgentProperties navAgetProp = FNavAgentProperties(34, 176);
                     UNavigationSystem* NavSys = UNavigationSystem::GetCurrent(GetWorld());
                     FPathFindingResult PathResult;
                     TArray<FVector> Result;
                     PathResult = NavSys->FindPathSync(navAgetProp, Query);
                     for (FNavPathPoint point : PathResult.Path->GetPathPoints())

Despite there is an obstacle in his way, and as I can see he arounds it, Result contains only 2 vectors - start and end vector. What do I do wrong? how can I get the turn points?

Product Version: UE 4.8
more ▼

asked Aug 23 '15 at 05:55 PM in C++ Programming

avatar image

82 9 17 26

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

1 answer: sort voted first

When you're using detour avoidance the path found for AI is not being string-pulled since it's not required for crowd agents. The path contains the full navigation corridor information though.

If you need a string-pulled path you can always call PerformStringPulling on the path instance.



more ▼

answered Aug 23 '15 at 09:07 PM

avatar image

MieszkoZ STAFF
7.3k 225 57 413

avatar image Darkstorm1997 Aug 24 '15 at 11:04 AM

I have been noticed that PerformStringPulling belongs to FNavMeshPath: https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/AI/Navigation/FNavMeshPath/PerformStringPulling/index.html

I do not have any object that derives from FNavMeshPath, how can I use this function? correct me if I am wrong. Also, this functio get 2 vectors and returns nothing. How do I suppose to use it?

avatar image Darkstorm1997 Aug 27 '15 at 09:51 PM

Hey, After research I think I know how to use PerformStringPulling but I still can figure out what FNavMeshPath can I use to get PerformStringPulling.

avatar image MieszkoZ STAFF Aug 27 '15 at 10:08 PM

You need to call CastPath() on your FNavigationPath instance.

avatar image Darkstorm1997 Aug 28 '15 at 08:11 AM

Thank you it works great with NavMesh! Is it possible to get it work with AIController UCrowdFollowingComponent? My characters avoid each other with this component and the code does not seem to "know" this component.

avatar image Soumik_25 Apr 25 '19 at 02:53 AM

Can you please share how you do the PerformStringPulling function

(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