Support Forum

Navigation on a GridGraph with heights but without gravity

Hello,

I’m testing the trial version of A*Pathfinding in a very simple scenario. The scenario contains only a plane with terrain ondulations, the Pathfinding object with a GridGraph and a capsule with an AIPath.
I noticed that if I deactivate the gravity of the AIPath, the agent stops maintaining the height of the grid nodes and simply follows the XZ position of the nodes, although the Path drawn in the Scene window does take the heights into account.

Shouldn’t the agent always move through the grid nodes, am I doing something wrong, or is it something that is somehow fixed in the Pro version (maybe with the LayeredGridGraph or with another kind of AIPath)?

That can be easily checked in the AssetsAstarPathfindingProjectExampleScenesExample2_Terrain example that comes with the Free package. If we disable gravity in the Bot -> AIPath object and also disable the CharacterController component, the bot hides below the terrain as soon as it approaches an elevated navigable terrain.

Hi

If the AIPath script has no gravity then it will just try to move towards the points in the XZ plane. If you haven’t attached any other collision detection to it then it would also move through the terrain.

The AILerp movement script moves along the calculated path precisely, without any gravity or collision, that might be what you are looking for? https://arongranberg.com/astar/docs/movementscripts.html