I’m currently trying to create a custom Path Following Component for my AI character so that I can edit the path that it tells the character to go. The reason I am doing this is because I want to create a smoother path for the character (when changing directions and turning around corners). I am thinking of adding a few more points around the target location to create a curved path, but I’m not really sure where I can override the path points in the path following component. This is all done in C++.
If there is another way to solve this problem (smoothing out turns for AI characters) I would be willing to try something else as well.
I ran the game in the editor and everything worked as if I never changed anything. Then I ran it in debugging editor mode, and placed breakpoints in those two overridden functions. After running my AI in the game for a few minutes the breakpoints were never triggered, meaning my path following component isn’t being run in the first place. Am I initializing it incorrectly?
The name passed into SetDefaultSubobjectClass should match up with the name that the parent class (in this case AAIController) uses when creating the component. It’s a bid fiddly, as far as I know currently you just have to check the engine source code to find out. So anyway, you need to change it to:
So I’ve been tinkering around with RequestMove and UpdateMove, or well HandlePathUpdateEvent now actually. I’m not quite sure how to add points to the InPath though… I’ve been looking at FMetaNavMeshPath and creating one and passing it as the InPath to my Super. Is this the right, or even a valid way to go about it? The description of FMetaNavMeshPath sounds like what i need, since it talks about guided paths with past set waypoints
You need to dereference your pointer. It’s not common in the engine, but some of the AI code has (sensibly) started to use references instead of pointers to objects in function parameters. FMetaNavMeshPath(Locations, *Controller);