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. 

Understanding PathFollowingComponent

There is hardly any documentation on how to handle the actual movement of a custom PathFollowComponent (applying the SetLocations/rotations/etc.). There is this tutorial by Rama but he doesn't tell you where to even get the Controller to apply the location and rotation functions for movement. https://wiki.unrealengine.com/AI_Navigation_in_C%2B%2B,_Customize_Path_Following_Every_Tick

I have a very simple barebones class for my own custom PathFollowingComponent because I want to be able to dictate where and how a character moves (speed/direction) along a certain path as it goes from path node to path node:

 #include "Navigation/PathFollowingComponent.h"
 #include "NaturalPathFollow.generated.h"
 class PUEBLOSIM_API UNaturalPathFollowComp : public UPathFollowingComponent
     /** follow current path segment */
     virtual void FollowPathSegment(float DeltaTime) override;

     /** sets variables related to current move segment */
     virtual void SetMoveSegment(int32 SegmentStartIndex) override;

     /** check state of path following, update move segment if needed */
     virtual void UpdatePathSegment() override;

I already have an AIController class that uses this custom PathFollowingComponent and it is calling the 3 functions above successfuly. But I don't know where to go from here. The UE4 documentation does not offer examples and the raw source is not very helpful. How do I go about from here getting the current node position, next node position, and the object in which to apply velocity to traverse through the path???

Product Version: UE 4.17
more ▼

asked Aug 22 '17 at 12:34 AM in C++ Programming

avatar image

13 3 4 8

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

1 answer: sort voted first

Hi there,

I was looking for a solution to one of my issues with using a customized UPathFollowingComponent (my functions don't fire at all from the AIController, but I digress), and came across this question that I think I may be able to answer.

So the functions I found particularly useful are:

  • GetCurrentPathIndex();

  • GetNextPathIndex();

You can combine these with functions in FNavPathSharedPtr (FNavigationPath) by feeding the Index you obtained from the above functions:

  • GetSegmentDirection();

  • GetPathPointLocation();

With this information and the Pawn's current velocity, etc, the AI Controller should be able to work out the appropriate inputs. If you'd like me to share my code, I'm more than happy to do so even though mine is embarassingly basic. ;)

more ▼

answered Feb 07 '18 at 01:32 PM

avatar image

35 5 11 14

(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