RichFunnel not working - Goes straight to end

Hey there!

I’m currently using RichPath for my custom Kinematic characters to follow, and so far it’s been working wonderfully, but after taking a couple weeks off from my project, it appears the RichFunnel is no longer working and I really can’t see why. I’ve stepped through the code and it appears that the linecast is never obstructed, so the funnel ends up going straight to the paths endpoint (Unless there’s a RichSpecial somewhere along the way)

I honestly don’t remember changing anything in A* or my own pathfinding code between when it last worked and now so I’m really confused. I’d love some ideas on how I can begin to troubleshoot this and figure out what went wrong.

See the below pic. Green line is the seeker’s raw path. Dark blue line is the RichPath the AI is following.

Hmm, very unclear. I don’t know what could have changed this. Have you added any other modifiers to your character?

Nope, nothing like that unfortunately. I can share my code for using the RichPath as maybe I’m initializing it wrong or something…? I’ll post that in a little bit here.

Alright this is how I’m getting the path and initializing the RichPath. (_path is the RichPath)
There’s not many steps to screw up here lol.

private void CalculatePath()
    HasReachedTarget = false;

    if (_pathfindTargetTransform)
        _pathfindTargetPosition = _pathfindTargetTransform.position;


    PathfindSeeker.StartPath(transform.position, _pathfindTargetPosition, OnPathComplete);

private void OnPathComplete(Path p)
    if (!p.error)
        _path.Initialize(PathfindSeeker, p, true, true);
        Debug.Log("A path failed to calculate with error: " + p.error);

I’m currently using the 4.3.49 beta. I tried upgrading to .51 but ended up getting a swapchain D3D crash in unity any time I enabled gizmos for links.

All my geometry is marked Static, and it’s on the default layer. The recast navmesh itself uses Default as well. When debugging, I’ve narrowed it down to the graphs linecast, it seems to never hit anything when used in the RichFunnel, so I’m wondering if maybe its a layer mismatch or something? I’m really at a loss here.

Looks good to me. You might want to try to set the last parameter to false when initializing it, to rule out the funnel simplification causing problems.

No change to behaviour it seems. Here’s how I’m getting the “next goal position”:

Maybe my implementation is off. To get the next Goal Position I’m checking if the part is a RichSpecial or RichFunnel. If it’s a RichFunnel I get the exactEnd. Is that correct? It seemed to work before, as I believe each straight section of the simplified path would be its own RichFunnel right?

The number of nodes within the RichFunnel doesn’t seem to change when simplified or not simplified either.

I realize now as I typed that, that it’s clearly not the right way to use this. I studied RichAI.cs further and have figured out how to properly traverse funnels.

I had to use funnel.Update to get the list of corners into a buffer and use the 0th index as the next corner. (Making sure to clear the buffer before updating it)

This one is solved :slight_smile:

I appreciate you taking the time to give me a few directions to look Aron!

1 Like