How to replace Unity naveMeshAgent.Move()

I’m currently replacing Unity’s native NavMesh with the A* Pathfinding Project because it offers better support for runtime-generated terrains, and its code is open source. However, I’ve encountered an issue. I’ve realized that NavMeshAgent.Move() and AIPath.Move() are not equivalent. With NavMeshAgent.Move(), you only need to provide an offset coordinate, and even if this offset is outside the NavMesh, the character will automatically move along the mesh boundary. AIPath.Move doesn’t do this; even though I’ve added code to check if the destination is reachable, if it’s not, I want the character to still be able to move along the mesh boundary instead of stopping in place. I haven’t found a good solution yet and urgently need some viable suggestions.
This is the link to my previous question, which you didn’t respond to.
https://forum.arongranberg.com/t/smoothly-move-in-unable-walk-area/15260
Below is my current code:

 if (!owner.UseNavmesh)
        {
            CheckCanMove(direction * force * dt);
        }
        else
        {
            naveMeshAgent.Move(direction * force * dt);
        }

 private bool CheckCanMove(Vector3 direction, float force, float dt)
    {
        Vector3 targetDeltaPos = direction * force * dt;
        NNConstraint nnConstraint = NNConstraint.None;
        Vector3 movePosition = transform.position + targetDeltaPos; 
        GraphNode node = _recastGraph.GetNearest(movePosition, nnConstraint).node;
        GraphHitInfo hit;
        if (!_recastGraph.Linecast(transform.position, movePosition, node, out hit))
        {
            _aiPath.Move(targetDeltaPos);
            return true;
        }
        return false;
    }

Additionally, I read another link and tried checking the option AIPath.constrainInsideGraph as true, which can constrain the movement within the mesh.
https://forum.arongranberg.com/t/how-do-you-push-a-character-in-a-direction-but-stay-in-the-navmesh/11863/4

It works very well on a flat surface, but it doesn’t seem to work for different heights in 3D. For example, at the same height level, it’s impassable on the first floor but passable on the second floor, which results in characters on the first floor being incorrectly allowed to reach, as shown in the image below:
image

Hi

Would you mind trying the beta version? I think that clamping should work better in the beta.

Though, the included movement scripts really aren’t intended to be replacements for a character controller.

The version I’m currently using is 4.2.19, and I’ve found a seemingly viable solution. I used AIPath.Move(), and at the end of the AIBase.FinalizePosition method, I executed the content in the LateUpdate method of NavmeshClamp to achieve the effect of constraining within the navmesh. However, I’ve noticed that the graph.Linecast method seems to have a bug—it suddenly returns true in walkable areas, causing the character to teleport. I’ve seen others mention this issue in different forums as well. I’d like to know what the most reliable and appropriate solution is at the moment.

You could try out the beta version. Several bugfixes have been made to the linecast method in the beta.