Will A* work with my own waypoints in 3D space?

Hi,

I have a system that dynamically creates Vector3 values for all 8 corners of a large cube, thus creating 8 nodes. I will use the nodes as a route to a target object on the other side of the large cube.

Can I assign these custom nodes dynamically to A*, and pass the shortest node route to the AI enemy, which uses it’s own custom Physics movement script? The AI enemy already has a waypoint system set-up to receive Vector3 co-ordinates, and it is able to move in all three dimensions. All I need now is to work out the shortest route and I am hoping A* can help with that.

I’m finding the prospect of pathfinding quite daunting, and would like to know if this is at least possible before I jump in feet first!

Thanks

Voxel

Sure, it will work.
The easiest is to use a point graph. Or if you want more control, write a custom graph generator: http://arongranberg.com/astar/docs/writing-graph-generators.php

However if you only have 8 corners… this pathfinding system is a bit overkill. You could get something more specialized for your application in less than 50 lines of code.

Thanks for confirming about A* much appreciated. Although you might be able to write it in less than 50 lines of code, my limited UnityScript skills will morph it into 500 lines of code :wink: I only started learning about 5 months ago with no real programming experience lol. I am going to explore doing my own one though, I figure it will be a nice project to work on in itself.