A* Pathfinding Project

2D Jump and gravity


Hi, I made a 2D game; the enemy’s AI is based on Grid graph of A* Pathfinding(Pro version); but I’ve problem with gravity, the enemy fly!

I use Unity 2018.1.0f2 and A* Pathfinding 4.1.16
Thanks for the attention!



Sorry for the late answer.

This type of platformer game is unfortunately not something that this package is aiming to support at the moment. It’s quite tricky to do it with a grid graph because the air will be walkable.

I think you might have better luck with a point graph where you position the nodes along the ground.


I used Point Graph with manual connection(I used NodeLink), but how I configure Astar Path? I setted Max Distance to 0.1 and Tag at ‘Node’(the same tag as objects with the NodeLink script) but GameObject doesn’t move.


I’ve this problem, enemy comes down when it shouldn’t.



I have just uploaded version 4.2.8 (https://www.arongranberg.com/astar/download) which adds a new option for the point graph that determines how the closest nodes should be found. Try it out and set the nearest node mode to ‘Connection’. I think that will work for you.


@aron_granberg Thanks a lot! Sorry, one last question; I’m using AILerp, can I disable its base movement and call my function? For example, if I have to move the character to the left I call Left().



If you want to do that I would recommend that you either write your own movement script (see https://arongranberg.com/astar/docs/custom_movement_script.html) or use the AIPath script while overriding movement (see https://arongranberg.com/astar/docs/iastarai.html#MovementUpdate)


@aron_granberg Thanks a lot! For the jump? I have created a list with all the ‘jumpable nodes’, in PathInterpolator->NextSegment check if the current node(segmentIndex) and the next(segmentIndex+1) one are part of the list and in the ‘jump’ case. But often it happens that the ‘jump’ starts late. Seeker setted on ‘Node Connection’ for start and end point snapping.