Smoothly move In Unable Walk Area

Our game requires character movement to be controlled through a joystick, meaning each frame receives a direction to calculate whether the new position is reachable. Therefore, I’m using AIBase.Move() and Recast Graph for movement.

However, there’s an issue as shown in the image: when I drag the joystick to the right, even though there’s no path to the right, I want the character to smoothly move diagonally downwards instead of being stuck in place. How can I achieve this functionality?

Hi

For these cases, I find the most robust method to do something like this:

void Update () {
    const float someDistance = 1f;
    ai.destination = ai.position + joystickDirection.normalized * someDistance;
}

This will make the agent move in the joystick direction, and it will be able to automatically avoid small obstacles.

But keep in mind that if you do not need any pathfinding at all, you are probably better off with a separate package that is specifically built as a character controller (and not a pathfinding agent).