So I have a top down game and you always move towards the cursor by default. But the way the pathing works, if you accidentally move the cursor past a wall then he will turn around to find the quickest path there.
So what I want is to be able to lock the cursor into a small circle surrounding the player that is placed on the floor, so the cursor is effectively no more than like lets say 50px away from them at any time. Any ideas as to how I would go about doing that?
calculate direction vector: click location minus player location.
now you need to do some tricks to that direction vector: multiply it by [1,1,0] (this will remove Z axis). Then normalize that vector.
that normalized vector now has length of 1 and is always horizontal.
now calculate final destination for your character: multiply that normalized vector by 90 to 150 (90 is shortest distance that character moves without errors), and add to that vector [0,0,90] this is because navmesh sometimes gives errors when you move to location that is right on feet level, you need move to location bit above ground level.
You should have your moving thingy. This was the simple method.
More advanced thing would be using EQS to find destinations. So watch behavioral trees and EQS tuts.
To get EQS destination you need to make function that finds all valid navmesh locations in radius around querier. THen you test if that location is visible to querier. And Closest one to click location wins. This (EQS) is very simple to do, if you know EQS system. However learning EQS is a bit steep.