Using A* without pre-made terrain or plane

I’m working on a game which allows for some basic customization of the platform that a users base sits on. These platforms and their layouts are therefore created at run time.

I was able to get A* working near instantly in a test scene where I created a terrain, capsule and some obstacles per the tutorial, however I’m having trouble getting it to work in a real game scene.

I did get A* working in a real game scene, but it ignored every obstacle placed in front of it and pathed off of the objects labeled as ground, promptly falling into the void of space.

Is there a guide to adding A* to a terrain generated at run time? Or perhaps I’m missing something entirely here.

Thanks for any help!

  • Chris

Hi

The AstarPath.active.Scan () function can be used to recalculate the whole graph at runtime.
If you want to update a smaller part of it you can use GraphUpdateObjects or GraphUpdateScene objects.
See tutorial here: http://arongranberg.com/astar/docs/graph-updates.php

Perfect Aron, Thanks for the quick response, and I apologize for taking so long getting back to you.

Calling that made things work immediately.

  • Chris