Originally posted by JeffL01234
View Post
When you are generating a heightmap for the grid you have the option of automatically setting cost between tiles based on height difference (this is a boolean you can check in the public variables of the grid manager). If you set this to false, then all tiles should be connected to their neighbors. After setting this to false you can instead check height differences for each unit during pathfinding. First create a new float jumpHeight in Unit that determines the max jump height of a unit. Then create a new custom pathfinding type. Go to the CustomPathfinding macro in BP_GridManager and modify SearchAndAddTileCustom1 (you can also create new such functions within this macro and expand the PathfindingType enum accordingly)
Inside the SearchAndAddTileCustom1 function (I might have the name slightly wrong. I'm on vacation and cannot check) add a new branch after the branch that checks if the new searched index has a cost of 0. In the new branch get the VectorFieldArray and get the vector at the index of the parent tile as well as of the child tile. Compare the absolute difference in their z values to the jumpHeight of the current unit. If it is higher, return false for the branch.
After you've done this, set the pathfinding type of your units to Custom 1 and it should hopefully work as you want it to.
Originally posted by Veliandr
View Post
Comment