Getting preview of a path and its cost from the Nav System in C++
I am working on a turn-based tactics game in unreal engine 4. One of the staples of these types of games is that you can preview the path that you will take before you travel there. Further, each possible path has a 'cost', and you can only move a certain distance per turn.
I was going to write my own A* implementation, but I would like to give the built in nav a shot so I can have smooth integration with the AI tools.
So, does anyone have any idea how to preview a path for a unit before you travel it, and get that paths associated cost? Not sure if this is supported natively or if I would have to implement it myself.
I am using c++, not blueprints btw.
asked Jan 08 '16 at 03:19 PM in C++ Programming
UNavigationSystem::FindPathToLocationSynchronously might be what you're looking for. That takes a start and end position and returns a UNavigationPath, which contains a list of points along the path and a function you can call to get the cost. Might take a while if the paths you're making are long, so just keep that in mind.
answered Jan 08 '16 at 04:18 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here