Pathfinding through mountains and hills

I am trying to generate nice, sensible looking paths throughout my randomly generated islands from various ‘monuments’ that will be scattered around.

i am to use the path finding feature to do this because i cant create the paths myself as it is procedurally generated.

My problem is that i cant find a way to incorporate terrain steepness or elevation changes into the costs of the pathfinding computation so my current paths look like this


Marked in red is my wanted result that should be taken with added weights to steepness and/or elevation.

I have tried scripting my own pathfinding algorithm however it is much too slow and gives back varied results and i’d like to know if there is a better way, other than spending days tailoring a new pathfinding algorithm myself.

1 Like

Ok i think i found a solution for if anyone comes across this issue also.

i first generate a path, resulting in the previous results, i then loop through each waypoint and apply my own conditions:

Raycast down to get the normal vector.
Calculate the angle.
If this angle is greater than my steepness angle then return false.

If false is returned, i insert a blocker part to block this area off, then recompute the path.

I do this in a loop until a pathway is found or a variable number of path iterations is made. These are my new results!

4 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.