JulianGrey / Unity3D_Pathfinding

Slowly but surely learning how to program pathfinding, with the view of making a game or virtual world out of it.
0 stars 0 forks source link

Tiredness is bad, m'kay? #5

Closed JulianGrey closed 9 years ago

JulianGrey commented 9 years ago

The new 8-way pathfinding I coded is calculating completely incorrectly, even though it works as expected. Rather than multiplying a node by 10 or 14 depending on whether the movement is horizontal/vertical or diagonal, it's multiplying each and every step by 10 or 14, resulting in stupidly high numbers.

JulianGrey commented 9 years ago

Calculation of adjacent node's distanceMoved variable should be the parent node's value plus the adjacent node's nodeResist value multipled by 10 or 14, depending on direction of travel.