Ensure RichAI goes in somewhat straight line

Hello! I’m building an enemy that attacks by rushing towards the player, and the player has to avoid the attack, causing the enemy to keep going until it hits a wall.

I’ve made it so it sends out a spherecast, ensuring there is nothing in the way. However, that does not mean the RichAI will not do odd things, modifying the path around changes in the terrain, etc. This is usually what you want, but in this case, it is not.

Is there a way to either add a cost associated with rotating, or having a max rotation? I imagine it’s essentially like steering, but I don’t really know how that works on A* Pathfinding Project.


Try to use a graph linecast instead. That will ensure there is a straight line even in the pathfinding graph.
See https://arongranberg.com/astar/docs/navmeshbase.html#Linecast


1 Like