WaypointPath.cs

Hi, Anyone used this script successfully and can show some examples? I want to have an NPC following a set of waypoints rather than a point from A to B and I think this script does the trick. http://www.arongranberg.com/astar/docs/_waypoint_path_8cs-example.php

No, but I use a much simpler (and probably inferior) version I came up with which basically consists of a list of Vector3’s that are looped over in an overridden AIPath.OnTargetReached() method. It increments an index value once the target is reached, and then changes the active target to the next waypoint in the list and flips the targetReached boolean to false.

Give me a bit and I’ll drop this in place of mine and get back to you…

Well, it works out of the box, sort of. Just put WaypointPath in your scripts folder and add the WaypointPathTester script as a component of something. Create some waypoint objects in your scene and add them to the Tester’s public Transform array. I’m not getting the lines to draw, but I definitely get valid vectorpaths out of it. You’ll need to add some code to the Tester if you want your agents to move. Take a look at AIPath.cs (or probably RichAI.cs if you have the paid version) . The API for Path and WaypointPath look pretty close, so you might be able to just swap them out.

Edit: No. You can’t just swap them out.

Thanks, will give it a go.