How to get distance from pathfinding?

From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • hello everyone, I want to know how to get distance from pathfinding

  • When the path found, you can repeat the node in the path finding behavior.

    Repeat Player.Pathfinding.NodeCount

    The distance will be calculate between node 1 and 0, 2 and 1,...etc.

    distance(Player.Pathfinding.NodeXAt(loopindex-1), Player.Pathfinding.NodeYAt(loopindex-1), Player.Pathfinding.NodeXAt(loopindex), Player.Pathfinding.NodeYAt(loopindex))

    You can add each of them into a total number and you will have the total distance from your player and destination.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • When the path found, you can repeat the node in the path finding behavior.

    Repeat Player.Pathfinding.NodeCount

    The distance will be calculate between node 1 and 0, 2 and 1,...etc.

    distance(Player.Pathfinding.NodeXAt(loopindex-1), Player.Pathfinding.NodeYAt(loopindex-1), Player.Pathfinding.NodeXAt(loopindex), Player.Pathfinding.NodeYAt(loopindex))

    You can add each of them into a total number and you will have the total distance from your player and destination.

    Many thanks, it work

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)